Hello,
Some time ago WarPigl3t was kind enough to provide me with a macro to hide rows based on range values.
However, if the first column is blank, the macro will not function at all. For example, the values are between column 4 and 6. Columns 5 and 3 are blank while columns 2 has descriptions and column 1 is also blank. The macro will not work if the first column is blank, but will function if I type a number on it, even though the macro is not set to include the first column in the range. The problem goes away if the first row is deleted, and the range goes back to firstColumn =3 and lastColumn = 5 instead of firstColumn =4 and lastColumn = 6.
Does anyone know how I can resolve this so I do not have to edit all tables to include a random number on each row on the first blank column?
Thanks in advance!
Some time ago WarPigl3t was kind enough to provide me with a macro to hide rows based on range values.
However, if the first column is blank, the macro will not function at all. For example, the values are between column 4 and 6. Columns 5 and 3 are blank while columns 2 has descriptions and column 1 is also blank. The macro will not work if the first column is blank, but will function if I type a number on it, even though the macro is not set to include the first column in the range. The problem goes away if the first row is deleted, and the range goes back to firstColumn =3 and lastColumn = 5 instead of firstColumn =4 and lastColumn = 6.
Code:
Sub hideRowMacro() firstRow = 6
lastRow = Range("A" & Rows.Count).End(xlUp).Row
firstColumn = 4
lastColumn = 6
r = firstRow
Do Until r > lastRow
c = firstColumn
Do Until c > lastColumn
myValue = Cells(r, c).Value
If Round(myValue, 2) <> 0 Then
Rows(r).Hidden = False
Exit Do
Else
Rows(r).Hidden = True
End If
c = c + 1
Loop
r = r + 1
Loop
End Sub
Does anyone know how I can resolve this so I do not have to edit all tables to include a random number on each row on the first blank column?
Thanks in advance!