I have this piece of code to hide some rows which works perfectly:
I tried converting it to hide some columns on another worksheet and I'm getting a run time error 1004 application defined or object defined error on the bolded line
What am I doing wrong?
Thanks
Code:
If Not Intersect(Target, Range("B3")) Is Nothing And [B3] >= 1 And [B3] <= 40 Then
With wsRecords
.Unprotect "password"
wsRecords.Rows("3:42").Hidden = True
wsRecords.Rows("3:" & Target.Value + 2).Hidden = False
End With
End If
Code:
If Not Intersect(Target, Range("B3")) Is Nothing And [B3] >= 1 And [B3] <= 40 Then
With wsDrivers
.Unprotect "password"
[B] wsDrivers.Columns("6:45").Hidden = True[/B]
wsDrivers.Columns("6:" & Target.Value + 5).Hidden = False
End With
End If
What am I doing wrong?
Thanks