Excel VBA Sheet properties Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kaztuba1
    New Member
    • Jan 2008
    • 1

    Excel VBA Sheet properties Question

    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?
Working...