Just for your info, I found an alternate method that also works
Sub HideRows()
Dim cell As Range
For Each cell In Range("e:e")
If UCase(cell.Value) = "NO" Then
cell.EntireRow.Hidden = True
End If
Next
End Sub
Thanks for the help, great forum
Hello,
I would like to piggy-back on this thread but it accomplishes a similar task....
How would I write the following code to prompt the user for a column? Or better yet prompt for a range within a column (ex. B7:B55). Since the column may not always be B:B.
Sub HideRows()
Dim cell As Range
Dim PromptedValue As String
PromptedValue = InputBox("Please enter the column you wish to use (eg. A:A, A1:A100 etc.", "Input Column", "A:A")
If PromptedValue = "" Then
Exit Sub
Else
For Each cell In Range(PromptedValue)
If UCase(cell.Value) = "" Then
cell.EntireRow.Hidden = True
End If
Next
End If
End Sub
Hi
I would like to use this code with a spreadsheet I have where if after a certain date...say 1/1/11 the rows automatically hide themselves or even better archive themselves to another worksheet! Have tried adapting the code in the posts above to no avail!
Thanks
Sub HideRows()
Dim cell As Range
For Each cell In Range("b:b")
If UCase(cell.Value) = "01/01/2011" Then
cell.EntireRow.Hidden = True
End If
Next
End Sub
Hi,
How would you achieve the reverse - e.g. code so that the four rows following the row in which the cell is with a value lies, are hidden unless a value of "Yes" appears in that cell?
Essentially looking at creating a template which has additional rows which become visible if the user answers with a "yes" in a particular cell. Obviously a "No" in the cell would keep the following four rows hidden.
Thanks for any answers.