Consulting

Results 1 to 3 of 3

Thread: Solved: print area

  1. #1
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    291
    Location

    Solved: print area

    Hello,

    I tried the following code

    Dim rng as String

    With ActiveSheet
    rng = .Range("A1", ActiveCell.SpecialCells(xlLastCell)).Address)
    .PrintArea = rng
    End With

    I get the following error

    Object not support this property or method

    Can anyone help

  2. #2
    VBAX Tutor
    Joined
    Dec 2006
    Posts
    220
    Location
    I think this is what you are trying to do. It involves a loop to find last empty cell. There is probably a better way to select the last row.

    [VBA]With ActiveSheet
    .Range("A1").Select
    Do While Not IsEmpty(ActiveCell)
    ActiveCell.Offset(1, 0).Select
    Loop
    .PageSetup.PrintArea = ActiveCell.CurrentRegion.Address
    End With
    [/VBA]
    "Intellectual passion occurs at the intersection of fact and implication."

    SGB

  3. #3
    VBAX Tutor
    Joined
    Dec 2006
    Posts
    220
    Location
    Better

    [VBA]With ActiveSheet
    Range("A:A").SpecialCells(xlCellTypeLastCell).Select
    .PageSetup.PrintArea = ActiveCell.CurrentRegion.Address
    End With[/VBA]
    "Intellectual passion occurs at the intersection of fact and implication."

    SGB

Posting Permissions

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