BACK

 

 

Prezentacija izvođenje makroa

Option Explicit


Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim Stopped As Integer

Private Sub Pause(ByVal Pau As Single, ByVal DoEv As Integer)
Call Sleep(Pau)
If DoEv = 1 Then DoEvents
End Sub


Sub SlowMotion()
Dim c As Range
Dim i
Range("a1:e10").Delete
i = 1
For Each c In Range("a1:a10")
c.Value = i
Call Pause(200, 1)
c.Offset(0, 1) = c.Value * 3
Call Pause(200, 1)
c.Offset(0, 2) = "=RC[-2]+RC[-1]"
Call Pause(100, 1)
c.Offset(0, 2).Interior.ColorIndex = 36
Call Pause(200, 1)
c.Offset(0, 3) = "'" & c.Offset(0, 2).Formula
Call Pause(100, 1)
c.Offset(0, 3).Interior.ColorIndex = 40
Call Pause(500, 1)
i = i + 1
Next
End Sub

Kako se može usporiti izvođenje makroa u cilju neke prezentacije ili edukacije

 

 

Animirani tekst

Sub Animacija()
Dim C As Range
Dim i%
Range("A1") = "CROExcel.com "
Set C = Range("A1")
For i = 1 To 120
C = Right(C, Len(C.Value) - 1) + Left(C, 1)
Sleep 80
Next i
End Sub

 

 

Unija

Sub Union()
Dim PodA, PodB, PodP, PodC As Range
Set PodA = Range(Cells(1, 2), Cells(7, 4))
Set PodB = Range(Cells(9, 4), Cells(12, 4))
Set PodC = Range(Cells(14, 6), Cells(17, 8))
Set PodP = Application.Union(PodA, PodB, PodC)
PodP.Name = "PODRUCJE"
MsgBox PodA.Address & vbCrLf & PodB.Address & vbCrLf & PodC.Address, , "CROExcel.com"
Range("PODRUCJE").Select
End Sub

Back to Top

 

Istupi iz područja

Sub Prostor()
Set Prost = Range("D2:G12")
Prost.Cells.Value = "PROSTOR"
Prost.Offset(Prost.Rows.Count, 5).Resize(1).Select
End Sub

Sub Istup1()
Range("d7").Resize(1, 5).Select
End Sub

Sub Istup2()
Range(Cells(5, 3), Cells(5, 3)).Resize(3, 3).Select
End Sub

Sub Istup3()
Range("D3").Offset(4, 3).Resize(Selection.Rows.Count + 3, _
Selection.Columns.Count + 4).Select
End Sub

 

 

Obojan ponedjeljak

Sub boja()
kraj = Cells(65356, 1).End(xlUp).Row
For x = 1 To kraj
If Weekday(Cells(x, 1)) = 2 Then
Cells(x, 2).Interior.ColorIndex = 3
End If
Next
End Sub

 Back to Top

 

Numeriranje stranica u Excelu

Sub Uredjenje_stranice()
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "Stranica &P" 'Broj stranice
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 300 'Ukloniti stvara problem kod raznih printera
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
End Sub