I have a macro that formats a sheet for me but it seems to run extremely slow. I just wanted to make sure that there isn't a fast method or that i wasn't doing anything wrong to make it slow. Here is a peice of my code.
Sheets("Sheet A").Select
Range("C1000"). Select
Selection.End(x lUp).Select
ActiveCell.Offs et(1, 0).Range("A1"). Activate
myRow = ActiveCell.Row
myColumn = "$I"
myAddress = myColumn & "$" & myRow
myRange = "$A$1:" & myAddress
With ActiveSheet.Pag eSetup
.PrintTitleRows = "$1:$10"
.PrintTitleColu mns = "$A:$D"
End With
ActiveSheet.Pag eSetup.PrintAre a = myRange
With ActiveSheet.Pag eSetup
.LeftMargin = Application.Inc hesToPoints(0.2 5)
.RightMargin = Application.Inc hesToPoints(0.2 5)
.TopMargin = Application.Inc hesToPoints(0.1 7)
.BottomMargin = Application.Inc hesToPoints(0.1 7)
.HeaderMargin = Application.Inc hesToPoints(0.2 6)
.FooterMargin = Application.Inc hesToPoints(0.1 7)
.PrintQuality = 1200
.Draft = False
.FirstPageNumbe r = xlAutomatic
.Zoom = 60
.Orientation = xlPortrait
.PaperSize = xlPaperLetter
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDi splayed
End With
This code literally takes 10 to 20 seconds to run. Is formatting usually that slow?
Sheets("Sheet A").Select
Range("C1000"). Select
Selection.End(x lUp).Select
ActiveCell.Offs et(1, 0).Range("A1"). Activate
myRow = ActiveCell.Row
myColumn = "$I"
myAddress = myColumn & "$" & myRow
myRange = "$A$1:" & myAddress
With ActiveSheet.Pag eSetup
.PrintTitleRows = "$1:$10"
.PrintTitleColu mns = "$A:$D"
End With
ActiveSheet.Pag eSetup.PrintAre a = myRange
With ActiveSheet.Pag eSetup
.LeftMargin = Application.Inc hesToPoints(0.2 5)
.RightMargin = Application.Inc hesToPoints(0.2 5)
.TopMargin = Application.Inc hesToPoints(0.1 7)
.BottomMargin = Application.Inc hesToPoints(0.1 7)
.HeaderMargin = Application.Inc hesToPoints(0.2 6)
.FooterMargin = Application.Inc hesToPoints(0.1 7)
.PrintQuality = 1200
.Draft = False
.FirstPageNumbe r = xlAutomatic
.Zoom = 60
.Orientation = xlPortrait
.PaperSize = xlPaperLetter
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDi splayed
End With
This code literally takes 10 to 20 seconds to run. Is formatting usually that slow?