View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Reference A Combobox On The First page.

Private Sub Worksheet_Activate()
If Worksheets("Main").ddCity.Value = "" Then
MsgBox "Please Choose A City."
Worksheets("Main").Select
Worksheets("Main").ddCity.Activate
Exit Sub
End If

End Sub


This assumes ddcity is the name of an activeX combobox from the control
toolbox toolbar and the name ddcity is set in the name property when you
right click on it in design mode and select properties.


Tested and worked for me.
--
Regards,
Tom Ogilvy



"Sean" wrote in message
ups.com...
I have a combobox ( named "ddCity" ) placed on the first page of a
worksheet. On the Activate event of ANY other worksheet, I want to
display a polite message indicating they need to choose a city, first.

How do I reference the combobox?

Something like...

If isnull(Worksheets("Main").ComboBox("ddCity").value ) = True Then
MsgBox "Please Choose A City."
Worksheets("Main").ComboBox("ddCity").Select
Exit Sub
End If