Ok-so someone else had supplied this code to me to hide rows in my tab named "Annual Record" based on a cell's value in another tab. The other tab's names are WO1, WO2, WO3, etc...
The code that I currently have is:
Private Sub Workbook_SheetChange(ByVal sh As Object, ByVal Target As Range)
Set A = Sheets("Annual Record")
Set b = Sheets("WO1")
Set c = Sheets("WO2")
Set d = Sheets("WO3")
Set e = Sheets("WO4")
Set WorkOrder1 = A.Rows("4:7")
Set WorkOrder2 = A.Rows("8:11")
Set WorkOrder3 = A.Rows("12:15")
Set WorkOrder4 = A.Rows("16:19")
If b.Range("AH5") = "Not Started" Then
WorkOrder1.Hidden = True
Else: WorkOrder1.Hidden = False
End If
If c.Range("AH5") = "Not Started" Then
WorkOrder2.Hidden = True
Else: WorkOrder2.Hidden = False
End If
If d.Range("AH5") = "Not Started" Then
WorkOrder3.Hidden = True
Else: WorkOrder3.Hidden = False
End If
If e.Range("AH5") = "Not Started" Then
WorkOrder4.Hidden = True
Else: WorkOrder4.Hidden = False
End If
End Sub
Now this person indicated that if I only had to add a few more tabs, as in WO4, WO5, etc...it wouldn't be a big deal (and I agree). However, I need to add a significant amount of additional tabs. So this person suggested adding a loop or something. If you need more information, let me know, but I think you can follow the trend, 4 rows are hidded on Annual Record for each tab basically.
Without blowing this code into a book, is there a quicker way to do this if I need to add a bunch more tabs???
Bookmarks