LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default How to set up conditional formatting in Combobox list?

Chip,

The formula worked brilliant.

Thanks for your help.

Dave

P.s. Had a look at your website, very useful. I'll definately be looking
there again.

"Chip Pearson" wrote:

First things first. Are you using a combobox on a user form or
directly on a worksheet? If on a worksheet, are you using the combobox
from the Controls commandbar or the Forms command bar?

If you are using the combobox directly on the sheet and it is the
combobox from the Controls command bar, do the following.

Set the ListFillRange property to the range that contains the values
to be listed in the combobox, say A1:A10. Set the LinkedCell property
to some other cell, say H1. Then, in some cell, enter the formula

=IF(ISERROR(MATCH(H1,A1:A10,0)),"not in list","in list")

If the selected item in the combobox comes from the dropdown list, the
cell will display "in list". If the item does not come from the
dropdown list, the cell will display "not in list".

For more effect, you could change "not in list" to FALSE and "in list"
to TRUE and then use Conditional Formatting to highlight the cell in
red if the item is not in the list.

If you are using a combobox on a user form, try code like the
following:


Private Sub ComboBox1_Change()
Dim S As String
Dim B As Boolean
Dim N As Long
With Me.ComboBox1
S = .Text
For N = 0 To .ListCount - 1
If StrComp(S, .List(N), vbTextCompare) = 0 Then
B = True
Exit For
End If
Next N
End With
If B = True Then
Me.Label1.Caption = "In List"
Else
Me.Label1.Caption = "Not In List"
End If
End Sub

When the user changes the value of ComboBox1, the text of the combobox
is tested against each element in the List. If found, the Caption of
Label1 gets "In List". If not found in the list, Label1 gets "Not In
List".



Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Wed, 28 Jan 2009 07:05:06 -0800, DaveHarding
wrote:

Chip,

I already have Style property set to 2 - fmStyleDropDownCombo so that text
can be typed in or selected from the list but i want to identify when someone
enters text that is not already in the list. Is there some code/a way of
highlighting when the text entered is typed rather than chosen from the list.
I thought something like 'Conditional Formatting' where the background is
highlighted in say Red when the value entered does not appear in the drop
down list.

Thanks for any help you can offer.

Dave

"Chip Pearson" wrote:


Set the Style property to 2 - fmStyleDropDownCombo. To allow only
items in the list to be selected, set the Style to 1 -
fmStyleDropDownList.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

On Wed, 28 Jan 2009 05:43:01 -0800, DaveHarding
wrote:

I want to change the text in a Combobox list if text is typed in rather than
being chosen fom the list. Basically i want to be able to identify if someone
has not picked from the drop down list




 
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
Conditional Formatting a drop down list a02227 Excel Worksheet Functions 2 November 12th 08 09:28 AM
.AddItem list and populating combobox with created list pallaver Excel Discussion (Misc queries) 8 June 27th 08 12:36 PM
Conditional Formatting on a Filtered List Ken Excel Discussion (Misc queries) 4 March 13th 08 06:11 PM
conditional formatting from a list casey Excel Worksheet Functions 2 March 12th 08 02:51 PM
formatting the list items for ComboBox created using Forms Desmond Excel Discussion (Misc queries) 3 May 4th 06 10:04 AM


All times are GMT +1. The time now is 01:58 PM.

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

About Us

"It's about Microsoft Excel"