The Worksheet_Activate() sub is not working but the code jumps straight to
the Worksheet_Change(ByVal Target As Range) sub. This is where the error
comes in because I don't get the chance to select values for Range("D3")
which is dependent on Range("A3") which is dependent on the
Worksheet_Activate() sub.
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Range("A3") = ""
Range("D3") = ""
Range("G3") = ""
Range("A3").Select
With Range("A3").Validation
.Delete
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertInformation, _
Formula1:="CENTRAL,NORTHEAST,SOUTH,WEST"
End With
Application.ScreenUpdating = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim marketWS As Worksheet, rngmarketWS As Range
If Target.Address() = "$A$3" Then
Application.EnableEvents = False
Application.ScreenUpdating = False
Range("D3") = ""
Range("G3") = ""
Range("D3").Select
Select Case Target.Value
Case "CENTRAL"
With Range("D3").Validation
.Delete
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertInformation, _
Formula1:="ARKANSAS,CHICAGO,CINCINNATI,CLEVELAND,COLUMBUS,DENVER CO,DES
MOINES,DETROIT MI," & _
"INDIANAPOLIS IN,KANSAS CITY KS,KNOXVILLE
TN,LOUISVILLE,MILWAUKEE,MINNEAPOLIS MN," & _
"NASHVILLE,OKLAHOMA CITY OK,OMAHA,PITTSBURGH
PA,ST.LOUIS,TULSA OK,WICHITA KS"
End With
Case "NORTHEAST"
With Range("D3").Validation
.Delete
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertInformation, _
Formula1:="CENTRAL PA,CONNECTICUT,LONG ISLAND - NY,NEW
ENGLAND MARKET,NEW JERSEY NJ,NEW YORK NY," & _
"NY (UPSTATE),PHILADELPHIA
PA,VIRGINIA,WASHINGTON DC"
End With
Case "SOUTH"
With Range("D3").Validation
.Delete
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertInformation, _
Formula1:="ATLANTA,AUSTIN TX,BIRMINGHAM,CAROLINA,DALLAS
TX,HOUSTON TX,JACKSONVILLE,MEMPHIS," & _
"MIAMI FL, MOBILE,NEW ORLEANS,ORLANDO,PUERTO
RICO,TAMPA FL"
End With
Case "WEST"
With Range("D3").Validation
.Delete
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertInformation, _
Formula1:="ALBUQUERQUE NM,EL PASO TX,HAWAII HI,INLAND
EMPIRE,LA NORTH,LAS VEGAS,LOS ANGELES," & _
"PHOENIX,PORTLAND OR,SACRAMENTO,SALT LAKE CITY
UT,SAN DIEGO,SAN FRANCISCO,SEATTLE WA," & _
"SPOKANE WA"
End With
End Select
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
If Target.Address() = "$D$3" Then
Application.EnableEvents = False
Application.ScreenUpdating = False
Range("G3").Value = Evaluate("=SUMPRODUCT(--('BO
Download'!$A$4:$A$30000=$A$3),--('BO Download'!$B$4:$B$30000=$D$3),--('BO
Download'!$H$4:$H$30000=""Selected""))") & " Sites"
'""""""""""""""""""""""""""""""""""""""""""""""""""""""'
'" DETERMINE THE START AND END ROWS OF THE MARKET "'
'""""""""""""""""""""""""""""""""""""""""""""""""""""""'
Dim marketName As String
Dim startRow As Long, endRow As Long
marketName = Range("D3").Value
startRow = firstRow(marketName)
endRow = lastRow(marketName, startRow)
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub