I have a userform with 4 CombBoxes. I want to be able to have the ComboBoxes for each grayed out until a selection is made. The first one is the only one that should be ungrayed. Once the 3rd combobox is selected I want to give the ability to Run the report, and thus ungray the "Run" button. Is this possible in excel?
Microsoft Excel Objects - ThisWorkbook code
Forms - DataReport
Microsoft Excel Objects - ThisWorkbook code
Code:
'The following is for the Userform DataReport code
DataReport.ComboBox1.Clear
Columns("N:N").Select
Range("A2:HX29921").Sort Key1:=Range("N2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Data5m.Range("A1").AutoFilter
Call FillCombobox(Data5m.Range("N2", Data5m.Cells(Rows.Count, "N").End(xlUp)), DataReport.ComboBox1)
DataReport.Show
End Sub
Forms - DataReport
Code:
Private Sub ComboBox1_Change() 'was A, now N
DataReport.ComboBox2.Clear
If Data5m.FilterMode = True Then: Data5m.ShowAllData
Data5m.Range("A1").AutoFilter field:=14, Criteria1:="=" & DataReport.ComboBox1.Value
Call FillCombobox(Data5m.Range("X2", Data5m.Cells(Rows.Count, "X").End(xlUp)).SpecialCells(xlCellTypeVisible), DataReport.ComboBox2)
End Sub
Private Sub ComboBox2_Change() 'was EJ, now X
DataReport.ComboBox3.Clear
Data5m.Range("A1").AutoFilter field:=24, Criteria1:="=" & DataReport.ComboBox2.Value
Call FillCombobox(Data5m.Range("P2", Data5m.Cells(Rows.Count, "P").End(xlUp)).SpecialCells(xlCellTypeVisible), DataReport.ComboBox3)
End Sub
Private Sub ComboBox3_Change() 'was ED, now P
DataReport.ComboBox4.Clear
Data5m.Range("A1").AutoFilter field:=16, Criteria1:="=" & DataReport.ComboBox3.Value
Call FillCombobox(Data5m.Range("Q2", Data5m.Cells(Rows.Count, "Q").End(xlUp)).SpecialCells(xlCellTypeVisible), DataReport.ComboBox4)
End Sub
Private Sub ComboBox4_Change() 'was EI, now Q
Data5m.Range("A1").AutoFilter field:=17, Criteria1:="=" & DataReport.ComboBox4.Value
End Sub
Private Sub RunButton_Click()
Unload DataReport
Call Filtered
Call AMasterBuild
End Sub
Private Sub CancelButton_Click()
Unload DataReport
End Sub