Excel 2010:
So I have VBA script that toggles between hiding and unhiding a set of rows.
Private Sub CommandButton1_Click()
Dim myRng As Range
Dim myRng2 As Range
Dim IsHidden As Boolean
Set myRng = Me.Range("ProductionData")
IsHidden = myRng(1).EntireRow.Hidden
Me.Range("ProductionData").EntireRow.Hidden = True
myRng.EntireRow.Hidden = Not (IsHidden)
End Sub
However I have to add another criteria so that a set of rows are to remain hidden all the time.
Which rows are to remain hidden all the time is dependent on the cell value in column A within that range.
The cell values in column A is "Yes" or "No".
Any rows with cell value in column A of "No" are to remain hidden during the toggle.
How can I add or embed an if/and statement into the script so that the hide/unhide also looks for the cell value in column A and just toggles between the rest while any row with cell value column A of "No" remains hidden all the time?
I hope I was clear enough.
Hoping to be pointed in the right direction.
Thank you.
So I have VBA script that toggles between hiding and unhiding a set of rows.
Private Sub CommandButton1_Click()
Dim myRng As Range
Dim myRng2 As Range
Dim IsHidden As Boolean
Set myRng = Me.Range("ProductionData")
IsHidden = myRng(1).EntireRow.Hidden
Me.Range("ProductionData").EntireRow.Hidden = True
myRng.EntireRow.Hidden = Not (IsHidden)
End Sub
However I have to add another criteria so that a set of rows are to remain hidden all the time.
Which rows are to remain hidden all the time is dependent on the cell value in column A within that range.
The cell values in column A is "Yes" or "No".
Any rows with cell value in column A of "No" are to remain hidden during the toggle.
How can I add or embed an if/and statement into the script so that the hide/unhide also looks for the cell value in column A and just toggles between the rest while any row with cell value column A of "No" remains hidden all the time?
I hope I was clear enough.
Hoping to be pointed in the right direction.
Thank you.