edwin1956
10-23-2009, 08:56 AM
I use the following instructions but I find an error Hi to all
I use the following instructions but I find an error. When the value it zero or blank my macro stop. How I do when it find a cell with zero go to next cell and print the range since d9 to the last address.
Anybody know other way most effective
Public Sub printpromrecursos()
Dim final, chequea
chequea = True
Application.Goto reference:=Range("d54")
Do
Do While ActiveCell.Value > 0
'ActiveSheet.PageSetup.PrintArea = "$a$1:" & final
ActiveCell.Offset(0, 1).Select
If ActiveCell = 0 Then
ActiveCell.Offset(0, 1).Select
If ActiveCell > 0 Then
ActiveCell.Offset(0, 1).Select
End If
chequea = False
Exit Do
End If
Loop
Loop Until chequea = False
final = ActiveCell.Address
ActiveSheet.PageSetup.PrintArea = "$d$6:" & final
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.Goto reference:=Range("d6")
End Sub
I use the following instructions but I find an error. When the value it zero or blank my macro stop. How I do when it find a cell with zero go to next cell and print the range since d9 to the last address.
Anybody know other way most effective
Public Sub printpromrecursos()
Dim final, chequea
chequea = True
Application.Goto reference:=Range("d54")
Do
Do While ActiveCell.Value > 0
'ActiveSheet.PageSetup.PrintArea = "$a$1:" & final
ActiveCell.Offset(0, 1).Select
If ActiveCell = 0 Then
ActiveCell.Offset(0, 1).Select
If ActiveCell > 0 Then
ActiveCell.Offset(0, 1).Select
End If
chequea = False
Exit Do
End If
Loop
Loop Until chequea = False
final = ActiveCell.Address
ActiveSheet.PageSetup.PrintArea = "$d$6:" & final
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Application.Goto reference:=Range("d6")
End Sub