I need a macro to print a range from cell "A1" to the last non-zero cell in column L. this is my vba:
Sub findprint()
Dim i As Integer
Dim a As Integer
Dim b As Integer
i = WorksheetFunction.CountIf(Columns(12), 0)
a = WorksheetFunction.CountA(Columns(12))
b = a - i - 1
Range(Cells(a, 1), Cells(l, b)).Select
Selection.PrintOut Copies:=1, Collate:=True
End Sub
It shows "appliaction-defined or object-defined error" when I tried to run it. I'm a beginner of VBA and, hopefully someone could help me fix it.
Thanks!
Sub findprint()
Dim i As Integer
Dim a As Integer
Dim b As Integer
i = WorksheetFunction.CountIf(Columns(12), 0)
a = WorksheetFunction.CountA(Columns(12))
b = a - i - 1
Range(Cells(a, 1), Cells(l, b)).Select
Selection.PrintOut Copies:=1, Collate:=True
End Sub
It shows "appliaction-defined or object-defined error" when I tried to run it. I'm a beginner of VBA and, hopefully someone could help me fix it.
Thanks!