Hi all. I have 3 similar sheets that i am adding the same macro on. When I put it on all 3 it drastically slows it down a lot. Can someone advise if i wrote this correctly or if i'm missing something to make it go faster?
I have about 300 drop down options so the page is large and full of formulas.
Basically one is a quote page, the other is a quote with install and the third is a vendor one. I am trying to hide the rows of the line# cells i am not using and make it match on all three sheets.("Install Quote", "Crystal Quote", "Master Quote" or sheet "28", "29", "30"
As you can see i have made my quote to have 21 line#'s for my window quote entry(that is the range "AW" is hiding.
I have about 300 drop down options so the page is large and full of formulas.
Basically one is a quote page, the other is a quote with install and the third is a vendor one. I am trying to hide the rows of the line# cells i am not using and make it match on all three sheets.("Install Quote", "Crystal Quote", "Master Quote" or sheet "28", "29", "30"
As you can see i have made my quote to have 21 line#'s for my window quote entry(that is the range "AW" is hiding.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
ThisWorkbook.Worksheets("Install Quote").Unprotect ("7712")
Dim p As PivotCache
For Each p In ThisWorkbook.PivotCaches
p.Refresh
Next p
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
.DisplayStatusBar = False
End With
If Range("aw14") = "one" Then
Rows("27:287").EntireRow.Hidden = True
Else
Rows("27:287").EntireRow.Hidden = False
If Range("aw14") = "two" Then
Rows("40:287").EntireRow.Hidden = True
Else
Rows("40:287").EntireRow.Hidden = False
If Range("aw14") = "three" Then
Rows("53:287").EntireRow.Hidden = True
Else
Rows("53:287").EntireRow.Hidden = False
If Range("aw14") = "four" Then
Rows("66:287").EntireRow.Hidden = True
Else
Rows("66:287").EntireRow.Hidden = False
If Range("aw14") = "five" Then
Rows("79:287").EntireRow.Hidden = True
Else
Rows("79:287").EntireRow.Hidden = False
If Range("aw14") = "six" Then
Rows("92:287").EntireRow.Hidden = True
Else
Rows("92:287").EntireRow.Hidden = False
If Range("aw14") = "seven" Then
Rows("105:287").EntireRow.Hidden = True
Else
Rows("105:287").EntireRow.Hidden = False
If Range("aw14") = "Eight" Then
Rows("118:287").EntireRow.Hidden = True
Else
Rows("118:287").EntireRow.Hidden = False
If Range("aw14") = "nine" Then
Rows("131:287").EntireRow.Hidden = True
Else
Rows("131:287").EntireRow.Hidden = False
If Range("aw14") = "ten" Then
Rows("144:287").EntireRow.Hidden = True
Else
Rows("144:287").EntireRow.Hidden = False
If Range("aw14") = "eleven" Then
Rows("157:287").EntireRow.Hidden = True
Else
Rows("157:287").EntireRow.Hidden = False
If Range("aw14") = "twelve" Then
Rows("170:287").EntireRow.Hidden = True
Else
Rows("170:287").EntireRow.Hidden = False
If Range("aw14") = "thirteen" Then
Rows("183:287").EntireRow.Hidden = True
Else
Rows("183:287").EntireRow.Hidden = False
If Range("aw14") = "fourteen" Then
Rows("196:287").EntireRow.Hidden = True
Else
Rows("196:287").EntireRow.Hidden = False
If Range("aw14") = "fifteen" Then
Rows("209:287").EntireRow.Hidden = True
Else
Rows("209:287").EntireRow.Hidden = False
If Range("aw14") = "sixteen" Then
Rows("222:287").EntireRow.Hidden = True
Else
Rows("222:287").EntireRow.Hidden = False
If Range("aw14") = "seventeen" Then
Rows("235:287").EntireRow.Hidden = True
Else
Rows("235:287").EntireRow.Hidden = False
If Range("aw14") = "eighteen" Then
Rows("248:287").EntireRow.Hidden = True
Else
Rows("248:287").EntireRow.Hidden = False
If Range("aw14") = "ninteen" Then
Rows("261:287").EntireRow.Hidden = True
Else
Rows("261:287").EntireRow.Hidden = False
If Range("aw14") = "twenty" Then
Rows("274:287").EntireRow.Hidden = True
Else
Rows("274:287").EntireRow.Hidden = False
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
With Application
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
.DisplayStatusBar = True
End With
End Sub
Sub NewDropDownDefault()
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
.DisplayStatusBar = False
End With
Range("N8").ClearContents
Dim Rng As Range
Application.ScreenUpdating = False
On Error Resume Next
Set Rng = ActiveSheet.UsedRange.SpecialCells(xlCellTypeAllValidation)
Rng.Value = "'- Choose Option -"
On Error GoTo 0
With Application
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
.DisplayStatusBar = True
End With
ThisWorkbook.Worksheets("Install Quote").Protect ("7712")
End Sub
Sub AllowMacroWhenProtected()
Sheets("Install Quote").Protect Password:="7712", _
UserInterfaceOnly:=True
End Sub