Drofidnas
Board Regular
- Joined
- Jun 30, 2004
- Messages
- 126
Morning
I have the following VBA code to set the margins and footers of my page. The trouble is, each . step is taking 3 seconds to execute, meaning the whole snippet takes over a minute to run. It's part of a bigger macro which executes in under 5 seconds so this whole section is causing the lag.
Any idea why this might be or am I not using the code efficiently?
Cheers
Chris
I have the following VBA code to set the margins and footers of my page. The trouble is, each . step is taking 3 seconds to execute, meaning the whole snippet takes over a minute to run. It's part of a bigger macro which executes in under 5 seconds so this whole section is causing the lag.
Any idea why this might be or am I not using the code efficiently?
Code:
ActiveSheet.PageSetup.PrintArea = "$A$1:$E$17"
With ActiveSheet.PageSetup
.RightMargin = Application.InchesToPoints(0.99)
.LeftMargin = Application.InchesToPoints(0.4)
.TopMargin = Application.InchesToPoints(0.88)
.BottomMargin = Application.InchesToPoints(0.91)
.HeaderMargin = Application.InchesToPoints(0.4)
.FooterMargin = Application.InchesToPoints(0.63)
.LeftFooter = " 2-" & Worksheets("2_ADS_Data").Range("O" & rng)
.RightFooter = ""
.LeftHeader = " " & Worksheets("2_ADS_Data").Range("B1")
.RightHeader = ""
End With
Cheers
Chris
Last edited: