1
13 Whistling Pigs
I am trying to print out an excel sheet where only rows with column J not
equal to zero print. I used the following code found on a linked website.
When I print, I still get all 500 rows. Any idea why this code does not work?
Thanks
Sub Hide_Print_Unhide()
Dim rw As Long
Application.ScreenUpdating = False
With Sheets("Quotations")
For rw = 1 To 500
If Application.WorksheetFunction.CountJ( _
.Cells(rw, 1).Range("J1")) = 0 Then _
.Rows(rw).Hidden = True
Next rw
.PrintOut ' for testing use .PrintPreview
.Range("J1").EntireRow.Hidden = False
End With
Application.ScreenUpdating = True
End Sub
equal to zero print. I used the following code found on a linked website.
When I print, I still get all 500 rows. Any idea why this code does not work?
Thanks
Sub Hide_Print_Unhide()
Dim rw As Long
Application.ScreenUpdating = False
With Sheets("Quotations")
For rw = 1 To 500
If Application.WorksheetFunction.CountJ( _
.Cells(rw, 1).Range("J1")) = 0 Then _
.Rows(rw).Hidden = True
Next rw
.PrintOut ' for testing use .PrintPreview
.Range("J1").EntireRow.Hidden = False
End With
Application.ScreenUpdating = True
End Sub