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