Im using VBA build inside excel
is there a way to find if ComboBox has a value?
for example
i have 80 ComboBox and i want to check if they have a value like "A", "B", "C" and "D"
and if the value is blank like "" then stop the checking.

Im thinking something like this
but surely it doesn't work

Public Sub Test()
Dim ComboBox As String
Dim i As Long

    For i = 1 To 80 
        If ComboBox & i.Text = "Level 4" Then
            Range("S8") = "0.12"
        End If
    Next

End Sub

You are almost on the right track. :) Try the following...

Public Sub Test()
Dim cmbMyBox As ComboBox ''Do Not use ComboBox, it is a reserved name for ... combobox

Dim i As Integer
    For i = 1 To 80 
        If cmbMyBox(i).Text = "Level 4" Then ''Assuming that you have an array of 80 combo's
            Range("S8") = "0.12"
        Elseif cmbMyBox(i).Text = "" Then
            Exit Sub ''Exit and do something...
        End If
    Next
End Sub

I got an error
Object variable or With block variable not set

and it highlight this code

        If cmbMyBox(i).Text = "Level 4" Then ''Assuming that you have an array of 80 combo's
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.