Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combo Box mandatory selection


Hi,

I have a Combo Box (added through the Control Toolbox) that I want t
be mandatory, i.e. it must always contain one of the values reference
in the ListFillRange. Currently I can select one of the values, but
can then overtype it with something else not in the list, or remove i
completely.

What is the best way to achieve this? I can do it easily using a Comb
Box from the Forms toolbar but I want to do some additional processin
on selection of a valid entry so I really need the Combo_Chang
subroutine.

To give a better idea of the overall picture, imagine a spreadshee
that has the Combo Box with values "Price List A" and "Price List B".
According to this selection, a named range will be amended using:

Code
-------------------
If Combo.Value = "A" Then
ActiveWorkbook.Names("pricelist").RefersTo = "=prices!$A$1:$B$10"
ElseIf Combo.Value = "B" Then
ActiveWorkbook.Names("pricelist").RefersTo = "=prices!$D$1:$E$10"
End If

-------------------

All subsequent lookup functions in the sheets can then use this name
range to look up the correct values.

What I want to avoid is the user typing in a random value or a blan
that the above code can't handle (ignoring for the moment the use of
catch-all Else at the end)

Thanks in advance,
Vindalo

--
Vindalo
-----------------------------------------------------------------------
Vindaloo's Profile: http://www.excelforum.com/member.php...fo&userid=3263
View this thread: http://www.excelforum.com/showthread.php?threadid=52446

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Combo Box mandatory selection

change properties

matchentry FmMatchEntryNone
style fmStyleDropDownList

then the user must select from the list.

--
Regards,
Tom Ogilvy


"Vindaloo" wrote:


Hi,

I have a Combo Box (added through the Control Toolbox) that I want to
be mandatory, i.e. it must always contain one of the values referenced
in the ListFillRange. Currently I can select one of the values, but I
can then overtype it with something else not in the list, or remove it
completely.

What is the best way to achieve this? I can do it easily using a Combo
Box from the Forms toolbar but I want to do some additional processing
on selection of a valid entry so I really need the Combo_Change
subroutine.

To give a better idea of the overall picture, imagine a spreadsheet
that has the Combo Box with values "Price List A" and "Price List B".
According to this selection, a named range will be amended using:

Code:
--------------------
If Combo.Value = "A" Then
ActiveWorkbook.Names("pricelist").RefersTo = "=prices!$A$1:$B$10"
ElseIf Combo.Value = "B" Then
ActiveWorkbook.Names("pricelist").RefersTo = "=prices!$D$1:$E$10"
End If

--------------------

All subsequent lookup functions in the sheets can then use this named
range to look up the correct values.

What I want to avoid is the user typing in a random value or a blank
that the above code can't handle (ignoring for the moment the use of a
catch-all Else at the end)

Thanks in advance,
Vindaloo


--
Vindaloo
------------------------------------------------------------------------
Vindaloo's Profile: http://www.excelforum.com/member.php...o&userid=32634
View this thread: http://www.excelforum.com/showthread...hreadid=524461


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Combo Box mandatory selection


Thanks very much Tom. Next time I'll have a proper look through th
properties! :)

Regards,
Vindalo

--
Vindalo
-----------------------------------------------------------------------
Vindaloo's Profile: http://www.excelforum.com/member.php...fo&userid=3263
View this thread: http://www.excelforum.com/showthread.php?threadid=52446

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
Combo box selection will not calculate Perrysbox2 Excel Worksheet Functions 1 June 11th 09 09:21 PM
Linking to combo box selection PSM[_14_] Excel Worksheet Functions 1 May 21st 09 12:57 AM
Multiple Selection Combo Box Ivor Davies Excel Discussion (Misc queries) 8 April 27th 09 12:43 PM
Multiple selection on a combo box Cesar Excel Worksheet Functions 3 December 17th 08 07:30 PM
multiple selection in combo box jen_writer Excel Discussion (Misc queries) 2 January 19th 07 09:05 PM


All times are GMT +1. The time now is 12:51 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"