With the below code, I need 2 help.
1. I would like to check if all the Combobox has value or not. In the screenshot, you can see I've created 2 new Combobox statically. When I execute this code the MsgBox throws the value Label and the code exits. I'm not sure where it's fetched from and the code doesn't alert for blank Combobox.
2. I would like to record the value selected in the new Combobox to cell S10. As I did for the previous 9 cells.
1. I would like to check if all the Combobox has value or not. In the screenshot, you can see I've created 2 new Combobox statically. When I execute this code the MsgBox throws the value Label and the code exits. I'm not sure where it's fetched from and the code doesn't alert for blank Combobox.
2. I would like to record the value selected in the new Combobox to cell S10. As I did for the previous 9 cells.
VBA Code:
Private Sub CommandButton2_Click()
'UserForm.Show vbModeless
Dim c As Control
For Each c In Me.Controls
If TypeName(c) = "Text Box" Or TypeName(c) = "ComboBox" Or TypeName(c) = "CommandButton" Then
If c.Value = "" Then
MsgBox "Please fill all the blank field(s)"
GoTo ok1
Exit For
Else: End If
Else
MsgBox TypeName(c)
GoTo ok
End If
Next c
ok:
Sheets("Sheet3").Range("S2").Value = ComboBox99.Value
Sheets("Sheet3").Range("S3").Value = ComboBox22.Value
Sheets("Sheet3").Range("S4").Value = ComboBox33.Value
Sheets("Sheet3").Range("S5").Value = ComboBox44.Value
Sheets("Sheet3").Range("S6").Value = ComboBox55.Value
Sheets("Sheet3").Range("S7").Value = ComboBox66.Value
Sheets("Sheet3").Range("S8").Value = ComboBox77.Value
Sheets("Sheet3").Range("S9").Value = ComboBox88.Value
Unload DataMap
Call DataImport
ok1:
End Sub