Results 1 to 2 of 2

Thread: excel and vba:printing

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    23
    here is what i have, but i am geting an error. I need to be able to print from A101 to the G column, but only up until the las t record in that column. I mean is if the are records from a101 to A 105, i need to just print them. But, this range can change.

    I have this code, but I am getting an undeclared error

    Sub p()
    Dim rowRng As Range, pntRng As Range

    With ActiveSheet
    Set rowRng = .Range("101:65536")
    Set pntRng = Intersect(pntRng.Parent.UsedRange, rowRng)
    .PageSetup.PrintArea = pntRng.Address
    .PrintOut
    Set rowRng = Nothing
    Set rowRng = Nothing
    End With

    End Sub
    Stephen Warker

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Leavenworth KS USA
    Posts
    482
    My bad, I left out init pntRng.
    This be better...
    Code:
    Sub p()
    Dim rowRng As Range, pntRng As Range
      With ActiveSheet
        Set rowRng = .Range("101:65536")
        '  Bigfoot sighting...
        Set pntRng = rowRng
        Set pntRng = Intersect(pntRng.Parent.UsedRange, rowRng)
        .PageSetup.PrintArea = pntRng.Address
        .PrintOut
        Set rowRng = Nothing
        Set rowRng = Nothing
      End With
    End Sub

    [Edited by Mongo on 07-10-2000 at 11:27 AM]

Posting Permissions

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



Click Here to Expand Forum to Full Width