Hi all,
I have some code (that doesn't work) that is intended to do the following:
If Cell DP11 <> "OK", then display a messagebox saying: "ERROR" and end the sub.
Else
Hide all the columns where the corresponding values in row 4 is = 0. Here is what I have:
Sub HideRows()
Dim i, startcol, endcol As Integer
startcol = 3
endcol = 32
If ((Range(DP11).Value <> "OK")) Then
MsgBox ("ERROR")
Else
For i = startcol To endcol
If ((Cells(4, i).Value = "" Or Cells(4, i).Value = 0)) Then
Columns(i).EntireColumn.Hidden = True
Else
Columns(i).EntireColumn.Hidden = False
End If
Next i
End If
End Sub
Can anyone help make the code work? Thanks!
Bookmarks