Hello - I am having trouble with finding a value in cells in "A" (= "ethnic balance") and hiding rows in a certain range around the found value. Here is what I have started but cant get to work:
Sub HideRows()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Dim hRow, uRow, bRow As Range
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To Lastrow
If Cells(i, "A") = "ETHNIC BALANCE" Then
hRow = Range(i, "A").Row
bRow = Range(i + 3, "A").Row
uRow = Range(i - 8, "A").Row
Range.Row("uRow:hRow").Hide
Range.Row("hRow:dRow").Hide
End If
Next
Application.ScreenUpdating = False
End Sub
Thanks for your help and if possible point out my errors - Jim A
Sub HideRows()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Dim hRow, uRow, bRow As Range
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To Lastrow
If Cells(i, "A") = "ETHNIC BALANCE" Then
hRow = Range(i, "A").Row
bRow = Range(i + 3, "A").Row
uRow = Range(i - 8, "A").Row
Range.Row("uRow:hRow").Hide
Range.Row("hRow:dRow").Hide
End If
Next
Application.ScreenUpdating = False
End Sub
Thanks for your help and if possible point out my errors - Jim A