- Feb 3, 2009
- Office Version
The code below only looks in the Range ("U41:U1000") however I would also like it to check Range("W41:W1000"), but I can't seem to get it to include that range as well. I have attempted Range("U41:U1000", "W41:W1000"), but that did not provide the results I was looking for. I need it to check both ranges then hide the row if it does not equal U38. It seemed like it was only looking in Range("W41:W1000") each time.
Private Sub Worksheet_Change(ByVal Target As Range) ActiveWorkbook.ActiveSheet.Unprotect Application.ScreenUpdating = False Application.Calculation = xlCalculationManual If Target.Row = 38 Then For Each c In Range("U41:U1000") If c.Value = Range("U38").Value Then c.EntireRow.Hidden = False Else c.EntireRow.Hidden = True End If Next c End If Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic ActiveWorkbook.ActiveSheet.Protect End Sub