Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Use VBA code to display message if combobox selection not in list

When using combo box to display drop-down list, users can actually type in
any value they want...not good for what I need. A feasible fix for this is
to verify that the value typed in the combo box is in a list...if it isn't
display a message that says Try Again.

Based on the list below, what would the VBA code look like that says if
combo box value is not in list then give error message?

List: Monday, Tuesday, Wednesday
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Use VBA code to display message if combobox selection not in list

Change the style of the combobox to fmStyleDropdownList (2).

hurlbut777 wrote:

When using combo box to display drop-down list, users can actually type in
any value they want...not good for what I need. A feasible fix for this is
to verify that the value typed in the combo box is in a list...if it isn't
display a message that says Try Again.

Based on the list below, what would the VBA code look like that says if
combo box value is not in list then give error message?

List: Monday, Tuesday, Wednesday


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Use VBA code to display message if combobox selection not in l

Other than converting the combobox to the form style...any help on the code
below?

Thanks

"Dave Peterson" wrote:

Change the style of the combobox to fmStyleDropdownList (2).

hurlbut777 wrote:

When using combo box to display drop-down list, users can actually type in
any value they want...not good for what I need. A feasible fix for this is
to verify that the value typed in the combo box is in a list...if it isn't
display a message that says Try Again.

Based on the list below, what would the VBA code look like that says if
combo box value is not in list then give error message?

List: Monday, Tuesday, Wednesday


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
TJS TJS is offline
external usenet poster
 
Posts: 1
Default Use VBA code to display message if combobox selection not in list


Hi,

It won''t convert the combobox. Just change its behavior.

But anyway, can use MatchRequired and then If MatchFound on change
event.

TJ :)


--
TJS
------------------------------------------------------------------------
TJS's Profile: http://www.excelforum.com/member.php...o&userid=29583
View this thread: http://www.excelforum.com/showthread...hreadid=496810

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Use VBA code to display message if combobox selection not in l

dim myArr as Variant
myArr = array("Monday","Tuesday","Wednesday")

if iserror(application.match(me.combobox1.value,myarr ,0)) then
'not a match, the board goes back
else
'do what you want
end if

But changing the .style is too easy to ignore.

hurlbut777 wrote:

Other than converting the combobox to the form style...any help on the code
below?

Thanks

"Dave Peterson" wrote:

Change the style of the combobox to fmStyleDropdownList (2).

hurlbut777 wrote:

When using combo box to display drop-down list, users can actually type in
any value they want...not good for what I need. A feasible fix for this is
to verify that the value typed in the combo box is in a list...if it isn't
display a message that says Try Again.

Based on the list below, what would the VBA code look like that says if
combo box value is not in list then give error message?

List: Monday, Tuesday, Wednesday


--

Dave Peterson


--

Dave Peterson
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
display list selection in a different cell notsomuchaguru Excel Discussion (Misc queries) 2 April 27th 10 06:51 PM
Display part of list dependant on Validation list selection Jules73 Excel Worksheet Functions 0 August 12th 09 02:21 PM
Userform: Textbox changing with selection in combobox (list) NorTor[_3_] Excel Programming 3 June 8th 04 10:19 PM
Select a value from a combobox drop down list through code TerryK Excel Programming 2 December 7th 03 07:01 AM
UserForm - display text message then run code Robert[_13_] Excel Programming 3 September 13th 03 11:37 AM


All times are GMT +1. The time now is 04:58 AM.

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"