Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Whats wrong with my code?

Private Sub ComboBox1_Change()
If Sheets("SYS").Range("A1:A18").Find(ComboBox1.Value ) = False Then
MsgBox "You have entered a invalid choice. Please make a valid
selection to continue.", vbCritical, "- INVALID SELECTION ERROR -"
ComboBox1.Value = ""
Exit Sub
End If
End Sub

The idea is to make it so if someone types in a drop down box and its
not one of the values they could select from...the application will
popup with an error message. My logic makes perfect sense to me but
VBA is having a hard time accepting it...any ideas as to why? Thanks
alot!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Whats wrong with my code?

Can you not POPULATE only the values in the Combobox from the range, thus eliminating the
possibility of the user entering an invalid entry?

wrote in message oups.com...
Private Sub ComboBox1_Change()
If Sheets("SYS").Range("A1:A18").Find(ComboBox1.Value ) = False Then
MsgBox "You have entered a invalid choice. Please make a valid
selection to continue.", vbCritical, "- INVALID SELECTION ERROR -"
ComboBox1.Value = ""
Exit Sub
End If
End Sub

The idea is to make it so if someone types in a drop down box and its
not one of the values they could select from...the application will
popup with an error message. My logic makes perfect sense to me but
VBA is having a hard time accepting it...any ideas as to why? Thanks
alot!


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Whats wrong with my code?

On May 2, 10:22 pm, Dave Peterson wrote:
And just to add to Corey's response, if you change the combobox's Style property
to fmstyledropdownlist, the user won't be able to type anything into that
combobox--except for the items in the list.





wrote:

Private Sub ComboBox1_Change()
If Sheets("SYS").Range("A1:A18").Find(ComboBox1.Value ) = False Then
MsgBox "You have entered a invalid choice. Please make a valid
selection to continue.", vbCritical, "- INVALID SELECTION ERROR -"
ComboBox1.Value = ""
Exit Sub
End If
End Sub


The idea is to make it so if someone types in a drop down box and its
not one of the values they could select from...the application will
popup with an error message. My logic makes perfect sense to me but
VBA is having a hard time accepting it...any ideas as to why? Thanks
alot!


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Yeah I've figured it out...Thanks everyone for the help!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Whats wrong with this code? Steve[_73_] Excel Programming 2 January 31st 06 04:13 PM
Whats wrong with this code? Joseph[_54_] Excel Programming 2 November 26th 04 04:31 PM
Whats wrong with this line of code? Edgar Thoemmes[_4_] Excel Programming 4 October 26th 04 12:52 PM
whats wrong with this code LiSa Excel Programming 2 September 8th 04 05:47 PM
Whats wrong with this code gav meredith Excel Programming 5 April 21st 04 12:01 AM


All times are GMT +1. The time now is 10:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"