First time posting - thanks in advance for your patience.
I have a macro to unhide/hide rows on selected sheets in a workbook based on the entry in ColB. The macro works on 3 of the 4 sheets - it does not run on the 4th 'Sponsored Funds Projection' sheet. If run while on the 4th sheet ('SFP'), it works for all 4. The 'Salary Summary' sheet is the data entry source that feeds the other sheets and I eventually want to create a button to run the macro from there, so it really needs to work from that sheet. The code I have is below (I pieced it together from various sites, including here). . Any insight is appreciated.
I have a macro to unhide/hide rows on selected sheets in a workbook based on the entry in ColB. The macro works on 3 of the 4 sheets - it does not run on the 4th 'Sponsored Funds Projection' sheet. If run while on the 4th sheet ('SFP'), it works for all 4. The 'Salary Summary' sheet is the data entry source that feeds the other sheets and I eventually want to create a button to run the macro from there, so it really needs to work from that sheet. The code I have is below (I pieced it together from various sites, including here). . Any insight is appreciated.
VBA Code:
Sub HideUnhideRows()
Dim mySheet As Variant, sheetsToEdit As Variant
sheetsToEdit = Array("Salary Summary", "Personnel Detail", "All Funds Projection", "Sponsored Funds Projection")
For Each mySheet In sheetsToEdit
Cells.EntireRow.Hidden = False
BeginRow = 6
EndRow = 200
ChkCol = 2
For RowCnt = BeginRow To EndRow
If Cells(RowCnt, ChkCol).Value = x Then
Cells(RowCnt, ChkCol).EntireRow.Hidden = True
End If
Next RowCnt
Worksheets(mySheet).Activate
MsgBox mySheet & " will be edited"
Next
End Sub
Last edited by a moderator: