maureenboyd60
New Member
- Joined
- May 4, 2021
- Messages
- 9
- Office Version
- 2016
Hello:
Thanks in advance for your help! I am new to VBA so my question may be quite simple! I have a range of data (Columns A:I) and an indeterminate number of rows. If the value in Column H = "complete' or "closed" I want to hide that row. Once the row is hidden, would it still show up in a search? I tried copying a macro I found on your site but it is not working. I assume I did not make the proper adjustments.
this is the macro I copied and tired to change. (I only tried it where cell in Column H = "complete"). The bolded row is where I believe the error is.
thanks!
Private Sub Worksheet_Calculate()
Dim lc As Long
Dim c As Long
' First unhide all rows
Cells.EntireRow.Hidden = False
' Find last row in column 8 with data
lc = Cells(8, Rows.Count).End(xldown).Row
' Loop through column 8 and hide all columns with "complete"
Application.ScreenUpdating = False
For c = 1 To lc
If Cells(8, c).Value = "complete" Then Cells(8, c).EntireRow.Hidden = True
Next c
Application.ScreenUpdating = True
End Sub
Thanks in advance for your help! I am new to VBA so my question may be quite simple! I have a range of data (Columns A:I) and an indeterminate number of rows. If the value in Column H = "complete' or "closed" I want to hide that row. Once the row is hidden, would it still show up in a search? I tried copying a macro I found on your site but it is not working. I assume I did not make the proper adjustments.
this is the macro I copied and tired to change. (I only tried it where cell in Column H = "complete"). The bolded row is where I believe the error is.
thanks!
Private Sub Worksheet_Calculate()
Dim lc As Long
Dim c As Long
' First unhide all rows
Cells.EntireRow.Hidden = False
' Find last row in column 8 with data
lc = Cells(8, Rows.Count).End(xldown).Row
' Loop through column 8 and hide all columns with "complete"
Application.ScreenUpdating = False
For c = 1 To lc
If Cells(8, c).Value = "complete" Then Cells(8, c).EntireRow.Hidden = True
Next c
Application.ScreenUpdating = True
End Sub