View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default combobox value < range

Be careful with this code. You may have to change a value in the testrange
to get the combobox enabled after it has been disabled. also so I used
Combobox1.Text, you can also use Combobox1.value. Not usre if you are
comparing text or numbers.

Sub disablecombbox()

Set testrange = Sheets("sheet1").Range("a1:a10")
found = False
For Each cell In testrange

If cell = ComboBox1.Text Then
found = True
Exit For
End If
Next cell

If found = True Then
ComboBox1.enable = True
Else
ComboBox1.enable = False
End If

End Sub


"Shawn" wrote:

I want a code that will make a combo box blank out if someone enters a value
other than a value in sheets("sheet1").range("a1:a10")


--
Thanks
Shawn