Consulting

Results 1 to 3 of 3

Thread: Solved: PageSetup

  1. #1

    Solved: PageSetup

    Howdy,

    I am looping through all worksheets in a file and for some reason cannot turn the dotted print area lines off. I recorded a macro and replicated it in my routine and it still doesn't work. Here's what I've got so far:

    Dim ws as worksheet

    for each ws in activeworkbook.worksheets
    ws.activate
    'bunch of other stuff
    with ws.pagesetup
    .printarea = ""
    .fittopagestall = 1
    .fittopageswide = 1
    end with
    next

    After I run my main macro, I still have to select all of my worksheets and do the pagesetup thingy.

    Anyone know what i'm doing wrong?


  2. #2
    VBAX Regular Chabu's Avatar
    Joined
    Dec 2010
    Location
    Brussels
    Posts
    85
    Location
    When I tried it I needed to change it like this
    [VBA]Public Sub pr()
    Dim ws As Worksheet

    For Each ws In ActiveWorkbook.Worksheets
    ws.Activate
    'bunch of other stuff
    With ws.PageSetup
    .PrintArea = ""
    .FitToPagesTall = 1
    .FitToPagesWide = 1
    .Zoom = False
    End With
    Next
    End Sub[/VBA]

    try if that works
    Greetings

  3. #3
    Bootyful! Thanks, Chabu!

    It was minor but, as i'm sure with everyone else here, I needed to know!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •