Greetings to all and thank you in advance for your help. I have a macro that runs a couple of procedures. The first procedure looks at the data in column 73 and hides certain rows depending on whether 0 is present. This macro works. However, I cannot get the second macro to work. After hiding the rows that show no data, I wanted to hide only certain rows if the range "SPINTOTAL" (which is the same as column 73) shows data other than 0
I thought maybe a "DoWhile loop" would work, but I cannot seem to get the right code. Any suggestion would be greatly appreciated. Thank you
Sub hiderow()
Dim x As Integer
Application.ScreenUpdating = True
Calculate
For x = 9 To 107
If Cells(x, 73) = "0" Then
Rows(x - 6).Hidden = True
Rows(x - 5).Hidden = True
Rows(x - 4).Hidden = True
Rows(x - 3).Hidden = True
Rows(x - 2).Hidden = True
Rows(x - 1).Hidden = True
Rows(x).Hidden = True
End If
x = x + 0
Next x
'Call hiderowwithnumber
Application.ScreenUpdating = True
End Sub
Public Sub hiderowwithnumber()
Dim SPINTOTAL As Variant
Application.ScreenUpdating = True
For Each cell In Sheets("1").Range("SPINTOTAL")
Do While (cell, 73)<> "0"
Rows(x - 6).Hidden = True
Rows(x - 5).Hidden = True
Rows(x - 3).Hidden = True
Rows(x - 2).Hidden = True
Rows(x).Hidden = False
Loop
Next cell
Application.ScreenUpdating = True
End Sub
Bookmarks