ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Slow Macro on Page Margin Change for all sheets (https://www.excelbanter.com/excel-programming/295972-slow-macro-page-margin-change-all-sheets.html)

Far

Slow Macro on Page Margin Change for all sheets
 
I have a Macro that changes the Print Page Margin on all
worksheets, but it very slow.

Is there a way to speed this up by forcing a calcualtion
of the the Margings at the end of the Macro doing recalc
on all sheets at once?

' Defines standard Footer & Header settings
For Each wks In Worksheets
If wks.Visible = xlSheetVisible Then
wks.PageSetup.LeftMargin =
Application.InchesToPoints(0.21)
wks.PageSetup.RightMargin =
Application.InchesToPoints(0.23)
End If
Next wks
End Sub

Thanks you for the help

TH[_3_]

Slow Macro on Page Margin Change for all sheets
 
I haven't tried this on your particular problem, but if you avoid selecting
things macros run a whole lot faster. Why don't you try this:

Application.ScreenUpdating = False
'then all your code, except skip the wks.visible part and just set all the
margins.

TH

On 4/22/04 12:38, in article , "Far"
wrote:

I have a Macro that changes the Print Page Margin on all
worksheets, but it very slow.

Is there a way to speed this up by forcing a calcualtion
of the the Margings at the end of the Macro doing recalc
on all sheets at once?

' Defines standard Footer & Header settings
For Each wks In Worksheets
If wks.Visible = xlSheetVisible Then
wks.PageSetup.LeftMargin =
Application.InchesToPoints(0.21)
wks.PageSetup.RightMargin =
Application.InchesToPoints(0.23)
End If
Next wks
End Sub

Thanks you for the help




All times are GMT +1. The time now is 06:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com