C
Cliff Myers
Hello all,
I'm having the hardest time with this, I'm trying to check for any blank
values in a number of comboboxes. I can get it to work using an If
statement for each cb but I really want to decrease the code by using a For
Next. Here's what I have and I cannot get it to work:
Dim cb As ComboBox
Dim MyCollection
Set MyCollection = ("Sheet1.ComboBox1:Sheet1.ComboBox5")
' if option 1 is chosen then e-mail workbook
If UserForm1.OptionButton1.Value = True Then
ActiveWorkbook.SendMail Recipients:="Cliff Myers", Subject:="test"
ElseIf UserForm1.OptionButton2.Value = True Then
For Each cb In MyCollection
If cb.Value = "" Then
MsgBox "All data is not complete"
Exit For
End If
Next cb
If Entrycells.Value = "" Then
MsgBox "You have an empty cell"
End If
Else
MsgBox "All data is complete"
End If
I'm having errors of object not found, defining objects, etc.
Any help is appreciated.
thanks,
cliff
I'm having the hardest time with this, I'm trying to check for any blank
values in a number of comboboxes. I can get it to work using an If
statement for each cb but I really want to decrease the code by using a For
Next. Here's what I have and I cannot get it to work:
Dim cb As ComboBox
Dim MyCollection
Set MyCollection = ("Sheet1.ComboBox1:Sheet1.ComboBox5")
' if option 1 is chosen then e-mail workbook
If UserForm1.OptionButton1.Value = True Then
ActiveWorkbook.SendMail Recipients:="Cliff Myers", Subject:="test"
ElseIf UserForm1.OptionButton2.Value = True Then
For Each cb In MyCollection
If cb.Value = "" Then
MsgBox "All data is not complete"
Exit For
End If
Next cb
If Entrycells.Value = "" Then
MsgBox "You have an empty cell"
End If
Else
MsgBox "All data is complete"
End If
I'm having errors of object not found, defining objects, etc.
Any help is appreciated.
thanks,
cliff