Hi all,
Very new to VB and macros and would appreciate some help on the below query please.
I have the following macros running on a worksheet in order to ‘hide’ and ‘show’ rows when they contain data (or not) within the cells in the range:
Sub HideRows_Proposal_Tables()
Sheet4.Unprotect Password:="xxx"
Application.ScreenUpdating = False
Application.Calculation = xlManual
For Each c In Range("D3:D22,D26:D39,E43:E57")
If c.Value = 0 And c.Value <> "" Then Rows(c.Row).Hidden = True
Next
Application.Calculation = xlManual
Application.ScreenUpdating = False
Sheet4.Protect Password:="xxx"
End Sub
Sub ShowRows_Proposal_Tables()
Sheet4.Unprotect Password:="xxx"
Application.ScreenUpdating = False
Application.Calculation = xlManual
For Each c In Range("D3:D22,D26:D39,E43:E57")
If c.Value = 0 And c.Value <> "" Then Rows(c.Row).Hidden = False
Next
Application.Calculation = xlManual
Application.ScreenUpdating = False
Sheet4.Protect Password:="xxx"
End Sub
The cells to be hidden (or shown) are populated on another worksheet in the same workbook and I've used a simple “=cellref” to populate them in the summary worksheet (the one with the macro).
My issue comes when a user has clicked the ‘hide rows’ button on the summary worksheet, and then adds a new name in an empty cell on the input worksheet that lies within the specified range. If the ‘hide/show’ buttons are subsequently clicked, those newly populated rows remain permanently hidden (unless I un-protect the worksheet and manually un-hide them). Is there a way to resolve this, other than entering all of the information prior to pressing ‘hide’, as this is a dynamic worksheet and can be edited at any time after someone has clicked the hide/show buttons?
I'll be honest, the above is not my handy work, I cobbled it together from sites and forums with similar issues to myself and no doubt there in lies my problem.
Thanks,
Bookmarks