Solved! Go to Solution.
Private Sub UserForm_Initialize() Dim x As Integer For x = 2010 To 2015 cboYear.AddItem x Next cboStations.AddItem "Annual" cboStations.AddItem "Urban" End Sub Private Sub cboStations_Change() If cboYear.Value <> "" Then UpdateDistrict End If End Sub Private Sub cboYear_Change() If cboStations.Value <> "" Then UpdateDistrict End If End Sub Private Sub UpdateDistrict() Dim myArray() Dim myElement As Variant cboDistrict.Clear myArray = Array() If cboStations.Text = "Annual" Then If cboYear.Text = "2010" Or cboYear.Text = "2011" Or cboYear.Text = "2012" Then myArray = Array("Abilene", "Amarillo", "Atlanta", "Austin", "Beaumont", "Brownwood", "Bryan", "Childress", "Corpus_Christi", "Dallas", "El_Paso", "Fort_Worth", "Houston", "Laredo", "Lubbock", "Lufkin", "Odessa", "Paris", "Pharr", "San Angelo", "San_Antonio", "Tyler", "Waco", "Wichita_Falls", "Yoakum") ' ElseIf cboYear.Text = "2011" Then ' myArray = Array("Abilene", "Amarillo", "Atlanta", "Austin", "Beaumont", "Brownwood", "Bryan", "Childress", "Corpus_Christi", "Dallas", "El_Paso", "Fort_Worth", "Houston", "Laredo", "Lubbock", "Lufkin", "Odessa", "Paris", "Pharr", "San Angelo", "San_Antonio", "Tyler", "Waco", "Wichita_Falls", "Yoakum") ' ElseIf cboYear.Text = "2012" Then ' myArray = Array("Abilene", "Amarillo", "Atlanta", "Austin", "Beaumont", "Brownwood", "Bryan", "Childress", "Corpus_Christi", "Dallas", "El_Paso", "Fort_Worth", "Houston", "Laredo", "Lubbock", "Lufkin", "Odessa", "Paris", "Pharr", "San Angelo", "San_Antonio", "Tyler", "Waco", "Wichita_Falls", "Yoakum") ' ElseIf cboYear.Text = "2012" Then ' myArray = Array("Abilene", "Amarillo", "Atlanta", "Austin", "Beaumont", "Brownwood", "Bryan", "Childress", "Corpus_Christi", "Dallas", "El_Paso", "Fort_Worth", "Houston", "Laredo", "Lubbock", "Lufkin", "Odessa", "Paris", "Pharr", "San Angelo", "San_Antonio", "Tyler", "Waco", "Wichita_Falls", "Yoakum") ' ElseIf cboYear.Text = "2013" Then ' myArray = Array() ' ElseIf cboYear.Text = "2014" Then ' myArray = Array() End If ElseIf cboStations.Text = "Urban" Then If cboYear.Text = "2010" Then myArray = Array("Abilene", "Amarillo", "Austin", "San_Antonio", "Waco", "Wichita_Falls") ElseIf cboYear.Text = "2011" Then myArray = Array("Beaumont", "Houston") ElseIf cboYear.Text = "2012" Then 'or just Else myArray = Array("Brownwood", "Bryan", "Childress", "Corpus_Christi", "El_Paso", "Lubbock", "Odessa", "Yoakum") ' ElseIf cboYear.Text = "2013" Then ' myArray = Array() ' ElseIf cboYear.Text = "2014" Then ' myArray = Array() End If End If For Each myElement In myArray cboDistrict.AddItem myElement Next End Sub
Private Sub cboYear_Change() dim myArray() as String cboDistrict.Clear If cboStations.Text = "Urban" Then If cboYear.Text = "2010" Then myArray = Array ("Abilene", "Amarillo", "Austin", "San_Antonio", "Waco", "Wichita_Falls" ) Elseif cboYear.Text = "2011" Then myArray = Array ("Beaumont", "Houston") Elseif cboYear.Text = "2012" Then 'or just Else myArray = Array ("Brownwood", "Bryan", "Childress", "Corpus_Christi", "El_Paso", Lubbock, "Odessa", "Yoakum") End If Elseif cboStations.Text = "Rural" If cboYear.Text = "2010" Then myArray = Array ("Abilene", "Waco", "Wichita_Falls" ) Elseif cboYear.Text = "2011" Then myArray = Array ("Beaumont") Elseif cboYear.Text = "2012" Then 'or just Else myArray = Array ("Brownwood", Lubbock, "Odessa", "Yoakum") End If End If For Each myElement in myArray cboDistrict.AddItem myElement Next End Sub
cboYear.Clear If cboStations.Text = "Urban" Then cboYear.AddItem "2010" cboYear.AddItem "2011" cboYear.AddItem "2012" Elseif cboStations.Text = "Rural" Then cboYear.AddItem "2011" End If
If cboStations.Text = "Annual" Then myArray = Array("Abilene", ... Else If cboStations.Text = "Urban" Then ' or just Else If if you won't have additional stations If cboYear.Text = "2010" Then myArray = Array("Abilene", ... etc End If For Each myElement in myArray cboDistrict.AddItem myElement Next