By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,946 Members | 727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,946 IT Pros & Developers. It's quick & easy.

Excel VBA Sheet properties Question

P: 1
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(xlUp).Select

ActiveCell.Offset(1, 0).Range("A1").Activate

myRow = ActiveCell.Row

myColumn = "$I"

myAddress = myColumn & "$" & myRow

myRange = "$A$1:" & myAddress



With ActiveSheet.PageSetup

.PrintTitleRows = "$1:$10"

.PrintTitleColumns = "$A:$D"

End With

ActiveSheet.PageSetup.PrintArea = myRange

With ActiveSheet.PageSetup

.LeftMargin = Application.InchesToPoints(0.25)

.RightMargin = Application.InchesToPoints(0.25)

.TopMargin = Application.InchesToPoints(0.17)

.BottomMargin = Application.InchesToPoints(0.17)

.HeaderMargin = Application.InchesToPoints(0.26)

.FooterMargin = Application.InchesToPoints(0.17)

.PrintQuality = 1200

.Draft = False

.FirstPageNumber = xlAutomatic

.Zoom = 60

.Orientation = xlPortrait

.PaperSize = xlPaperLetter

.FitToPagesWide = 1

.FitToPagesTall = 1

.PrintErrors = xlPrintErrorsDisplayed

End With

This code literally takes 10 to 20 seconds to run. Is formatting usually that slow?
Jan 7 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.