Print Macro


Posted by Rob on August 15, 2001 4:01 PM

I have a print macro that determines the range by finding the last cell in column H. This is fine and good, but I want to be able to print colum I also. BUT the problem is that, colunm I doesn't always have data, as H does. So testing column I wouldnt work. Is there a way to do print column "I" when testing "H"?

Here is the code:

Sub PrintMacro2()
Dim rPrintRange As Range
Dim CurrentSheetName As String
Dim PrintSheetName As String

CurrentSheetName = ActiveSheet.Name

PrintSheetName = InputBox("Type the name of the sheet(Tab) you want to print exactly:")
Sheets(PrintSheetName).Activate
If Range("A3") = "" Then Exit Sub

Set rPrintRange = Range("A1", Range("H65536").End(xlUp))

With Sheets(PrintSheetName).PageSetup
.PrintArea = rPrintRange.Address
.FitToPagesTall = 1
.FitToPagesWide = 1
.Orientation = xlLandscape
End With

Set rPrintRange = Nothing

Sheets(PrintSheetName).PrintOut
Sheets(PrintSheetName).DisplayPageBreaks = False

Sheets(CurrentSheetName).Activate

Range("A1").End(xlDown).Select

End Sub

Thanks

Posted by Robb on August 15, 2001 4:17 PM

Rob

Presuming there will be nothing in Col I below the last item in Col H, you could do this by using Offset, e.g.

Does this do it?

Posted by RoB on August 15, 2001 4:31 PM

Well, you did it again...much Praise!! One question...

Do you have an email that I might have if you dont mind? I tried earlier, but the mail got sent back to me. Is your account active?

Thanks again!

Posted by Robb on August 15, 2001 5:00 PM

Re: Well, you did it again...much Praise!! One question...

Rob

Add in this post should be correct now. You may use it but I don't look at it very often. Probably quicker to try via posting here.

Also, I have posted replies to 27123 and 27124 (you posted around 10:14 and 10:23 on 15th). Hope they help.

Regards



Posted by Rob on August 15, 2001 5:16 PM

Yes much help

: Do you have an email that I might have if you dont mind? I tried earlier, but the mail got sent back to me. Is your account active?