Hi!
I have inherited a workbook that is getting to long and hit the dreaded "Procedure too large"
Is there a simple way to shorten this code using a range even though it needs to look at 2 different worksheets to hide or unhide the row?
Here is an example of the code:
(I have another 194 sets that need to do the same thing.
Any advise would be greatly appreciated!
Kind regards.
I have inherited a workbook that is getting to long and hit the dreaded "Procedure too large"
Is there a simple way to shorten this code using a range even though it needs to look at 2 different worksheets to hide or unhide the row?
Here is an example of the code:
VBA Code:
Private Sub Worksheet_Deactivate()
If Sheets("SPECS-P").Range("O4").Value = 0 Then
Sheets("Proposal-P").Rows("142:145").EntireRow.Hidden = True
ElseIf Sheets("SPECS-P").Range("O4").Value > 0 Then
Sheets("Proposal-P").Rows("142:145").EntireRow.Hidden = False
End If
If Sheets("SPECS-P").Range("O5").Value = 0 Then
Sheets("Proposal-P").Rows("146").EntireRow.Hidden = True
ElseIf Sheets("SPECS-P").Range("O5").Value > 0 Then
Sheets("Proposal-P").Rows("146").EntireRow.Hidden = False
End If
If Sheets("SPECS-P").Range("O6").Value = 0 Then
Sheets("Proposal-P").Rows("147").EntireRow.Hidden = True
ElseIf Sheets("SPECS-P").Range("O6").Value > 0 Then
Sheets("Proposal-P").Rows("147").EntireRow.Hidden = False
End If
If Sheets("SPECS-P").Range("O7").Value = 0 Then
Sheets("Proposal-P").Rows("148").EntireRow.Hidden = True
ElseIf Sheets("SPECS-P").Range("O7").Value > 0 Then
Sheets("Proposal-P").Rows("148").EntireRow.Hidden = False
End If
If Sheets("SPECS-P").Range("O8").Value = 0 Then
Sheets("Proposal-P").Rows("149").EntireRow.Hidden = True
ElseIf Sheets("SPECS-P").Range("O8").Value > 0 Then
Sheets("Proposal-P").Rows("149").EntireRow.Hidden = False
End If
If Sheets("SPECS-P").Range("O9").Value = 0 Then
Sheets("Proposal-P").Rows("150").EntireRow.Hidden = True
ElseIf Sheets("SPECS-P").Range("O9").Value > 0 Then
Sheets("Proposal-P").Rows("150").EntireRow.Hidden = False
End If
If Sheets("SPECS-P").Range("O10").Value = 0 Then
Sheets("Proposal-P").Rows("151").EntireRow.Hidden = True
ElseIf Sheets("SPECS-P").Range("O10").Value > 0 Then
Sheets("Proposal-P").Rows("151").EntireRow.Hidden = False
End If
(I have another 194 sets that need to do the same thing.
Any advise would be greatly appreciated!
Kind regards.
Last edited by a moderator: