Hi to all. I am using a VBA code to hide all the lines that have 0 value in column 2. The trick is to run this VBA code when someone wants to print the worksheet. Would like to do this automatically so the code runs before worksheet is being printed instead of running VBA code manually and then print, this way no one could mistake of printing before running the VBA code. The VBA code i am using is as follows:
Sub zero()
BeginRow = 7
EndRow = 274
ChkCol = 2
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value <> 0 Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
Else
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
End If
Next RowCnt
End Sub
Does someone know a solution ?
Thal you
Sub zero()
BeginRow = 7
EndRow = 274
ChkCol = 2
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value <> 0 Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = False
Else
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
End If
Next RowCnt
End Sub
Does someone know a solution ?
Thal you