Check condition of cell value before populating combobo list

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,602
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I have the code supplied in use but would like to use it after a cell condition "if the correct word" is met.

The code populates a drop down list on a combobox.
The values at present are all used & are placed in combobox list.
I would like to now use only values that are NOT hyperlinked.
I couldnt see when searching if a hyperlink was applied etc so maybe the code could look at it being underlined or its blue font color the excel gives it as a workaround ?

Example
Values 1-8 ARE NOT hyperlinked BUT values 9 & 10 ARE so the code will only use values 1-8 for population.

Example code to use
If value is hyperlinked then ????

or

If value is underlined then ????

or

If value is excel blue font color then ??

Thanks

VBA Code:
    With GetObject("C:\Users\Ian\Desktop\REMOTES ETC\DR\DR.xlsm") 'THIS POPULATES THE DROPDOWN FOR THE CUSTOMERS NAMES
        Set s = .Sheets("POSTAGE")
        Set b2 = s.Cells(s.Range("B" & s.UsedRange.Rows.Count + 1).End(xlUp).Row, "B")
        Set b1 = b2.Offset(-10, 0) 'THE MINUS VALUE IS HOW MANY NAMES TO BE SHOWN IN DROP DOWN LIST
        ComboBox1.List = s.Range(b1, b2).Value
       .Close 0
End With
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Declare cel as range so you don't get a variable not defind error

and replace this
VBA Code:
        ComboBox1.List = s.Range(b1, b2).Value
with this for no hyperlink
VBA Code:
        For Each cel In s.Range(b1, b2)
            If cel.Hyperlinks.Count = 0 Then ComboBox1.AddItem cel.Value
        Next cel
 
Upvote 0
Solution

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top