Actually 53 lines of code. Just missed the blHide = (Target.Value = ""): Rw = Target.Row in the second part.
Thanks again for all your help. I really appreciate it. And hopefully this will help others.
I wish I knew how to do this earlier, because it took my like 1.5 hours to sit there and edit my code.
Now if I ever wanted to add 10 more lines, I just have to change the 33 value to 43, pretty awesome.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet, blHide As Boolean, Rw As Long
Const sPW As String = "pass1234"
Application.ScreenUpdating = False
'==================== Beauty Expert ====================
If Not Intersect(Target, ActiveSheet.Range("E4:E33")) Is Nothing Then
blHide = (Target.Value = ""): Rw = Target.Row
For Each ws In Sheets(Array("P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8", "P9", "P10", "P11", "P12", "P13"))
With ws
.Unprotect (sPW)
.Rows(Rw).Hidden = blHide
.Rows(Rw + 41).Hidden = blHide
.Rows(Rw + 82).Hidden = blHide
.Rows(Rw + 123).Hidden = blHide
.Protect (sPW)
End With
Next
With Sheets("Extra Week")
.Unprotect (sPW)
.Rows(Rw).Hidden = blHide
.Protect (sPW)
End With
With Sheets("Cosmetician Sales")
.Unprotect (sPW)
.Rows(Rw).Hidden = blHide
.Rows(Rw + 31).Hidden = blHide
.Protect (sPW)
End With
With Sheets("CAST")
.Unprotect (sPW)
.Rows((Rw - 4) * 19 + 1 & ":" & (Rw - 3) * 19).Hidden = blHide
.Protect (sPW)
End With
End If
If Not Intersect(Target, ActiveSheet.Range("I4:I33")) Is Nothing Then
blHide = (Target.Value = ""): Rw = Target.Row
With Sheets("Vendor Sales")
.Unprotect (sPW)
.Rows(Rw).Hidden = blHide
.Rows(Rw + 34).Hidden = blHide
.Rows(Rw + 68).Hidden = blHide
.Protect (sPW)
End With
With Sheets("Daily Sales Tracking")
.Unprotect (sPW)
.Rows((Rw - 4) * 2 + 382 & ":" & (Rw - 4) * 2 + 383).Hidden = blHide
.Columns((Rw - 3) * 6 + 4).Hidden = blHide
.Columns((Rw - 3) * 6 + 5).Hidden = blHide
.Protect (sPW)
End With
End If
Application.ScreenUpdating = True
End Sub
Bookmarks