M
Mel
I have the fololowing macro set up to print only rows with a data.
Columns A to I down to row 2000. Column i has the formula only. I
have no idea how to exclude the formula so that it does not count as
data. thx Mel
Sub SetUsedPrintArea()
Dim LastRow As Long
If WorksheetFunction.CountA(Cells) > 0 Then
'Search for any entry, by searching backwards by Rows.
LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
'MsgBox LastRow
End If
Dim LastColumn As Integer
If WorksheetFunction.CountA(Cells) > 0 Then
'Search for any entry, by searching backwards by Columns.
LastColumn = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
' MsgBox LastColumn
End If
ActiveSheet.PageSetup.PrintArea = Range(Cells(1, 1),
Cells(LastRow, LastColumn)).Address
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub
Columns A to I down to row 2000. Column i has the formula only. I
have no idea how to exclude the formula so that it does not count as
data. thx Mel
Sub SetUsedPrintArea()
Dim LastRow As Long
If WorksheetFunction.CountA(Cells) > 0 Then
'Search for any entry, by searching backwards by Rows.
LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
'MsgBox LastRow
End If
Dim LastColumn As Integer
If WorksheetFunction.CountA(Cells) > 0 Then
'Search for any entry, by searching backwards by Columns.
LastColumn = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
' MsgBox LastColumn
End If
ActiveSheet.PageSetup.PrintArea = Range(Cells(1, 1),
Cells(LastRow, LastColumn)).Address
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub