Hi, having issues with my code and getting the error message "<Method 'Range' of object '_Worksheet' failed>"
My code below, I just want to hide rows within the worksheet. this code worked fine before but when I made a change to the row numbers, I received this error message. Can anyone help? Thanks!!
Private Sub ListBox1_Click()
End Sub
Private Sub ComboBox1_Change()
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Sheets("REPORT").Range("F5") = Sheets("REPORT").Range("AL3") Then
Sheets("REPORT").Rows.Hidden = False
Range("A36,A38,A39,A92:A94,A171").EntireRow.Hidden = True
'Else: Sheets("REPORT").Range("A36,A38,A39,A92:A94,A171").EntireRow.Hidden = False
End If
If Sheets("REPORT").Range("F5") = Sheets("REPORT").Range("AL4") Then
Sheets("REPORT").Rows.Hidden = False
Range("A36,A38,A39,A92:A94,A169:170").EntireRow.Hidden = True
End If
If Sheets("REPORT").Range("F5") = Sheets("REPORT").Range("AL6") Then
Sheets("REPORT").Rows.Hidden = False
Range("A37,A170:171").EntireRow.Hidden = True
End If
If Sheets("REPORT").Range("F5") = Sheets("REPORT").Range("AL5") Then
Sheets("REPORT").Rows.Hidden = False
Range("A37,A168:169").EntireRow.Hidden = True
End If
If Sheets("REPORT").Range("F5") = Sheets("REPORT").Range("AL7") Then
Sheets("REPORT").Rows.Hidden = False
Range("A170:171").EntireRow.Hidden = True
End If
If Sheets("REPORT").Range("F5") = Sheets("REPORT").Range("AL2") Then
Sheets("REPORT").Rows.Hidden = False
End If
End Sub
My code below, I just want to hide rows within the worksheet. this code worked fine before but when I made a change to the row numbers, I received this error message. Can anyone help? Thanks!!
Private Sub ListBox1_Click()
End Sub
Private Sub ComboBox1_Change()
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Sheets("REPORT").Range("F5") = Sheets("REPORT").Range("AL3") Then
Sheets("REPORT").Rows.Hidden = False
Range("A36,A38,A39,A92:A94,A171").EntireRow.Hidden = True
'Else: Sheets("REPORT").Range("A36,A38,A39,A92:A94,A171").EntireRow.Hidden = False
End If
If Sheets("REPORT").Range("F5") = Sheets("REPORT").Range("AL4") Then
Sheets("REPORT").Rows.Hidden = False
Range("A36,A38,A39,A92:A94,A169:170").EntireRow.Hidden = True
End If
If Sheets("REPORT").Range("F5") = Sheets("REPORT").Range("AL6") Then
Sheets("REPORT").Rows.Hidden = False
Range("A37,A170:171").EntireRow.Hidden = True
End If
If Sheets("REPORT").Range("F5") = Sheets("REPORT").Range("AL5") Then
Sheets("REPORT").Rows.Hidden = False
Range("A37,A168:169").EntireRow.Hidden = True
End If
If Sheets("REPORT").Range("F5") = Sheets("REPORT").Range("AL7") Then
Sheets("REPORT").Rows.Hidden = False
Range("A170:171").EntireRow.Hidden = True
End If
If Sheets("REPORT").Range("F5") = Sheets("REPORT").Range("AL2") Then
Sheets("REPORT").Rows.Hidden = False
End If
End Sub