ComboBox RowSource assignment by procedure code?

TTom

Well-known Member
Joined
Jan 19, 2005
Messages
518
ComboBox RowSource assignment by procedure code:

In a module sub I want to have code that assigns the RowSource value to a named ranged prior to
showing the UserForm that contains the ComboBox where the RowSource is to be filled.
(This will fill the ComboBox with named range data.)

The following code gets an error as invalid. Is RowSource assignment by code not allowed for Comobox, or do I just need to tweak my code?

Thanks for any tips. TTom
<code>
ActiveWorkbook.Names.Add Name:="nrng_Jobs", RefersTo:="=Sheet2!$T$1:$T$" & Range("T6000").End(xlUp).Row

ufJobSelect.cbxJobSelect.RowSource = "nrng_Jobs"
</code>
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Even if I type in the named range, or even just a 'single cell range' into the ComboBox's RowSource
property setting I get an 'Invalid Property Value" error. Hmmm.... :rolleyes:
TTom
 
Upvote 0
Are you sure the range is being defined correctly?
Code:
With Worksheets("Sheet2")
    LastRow = .Range("T" & Rows.Count).End(xlUp).Row
    .Range("T1:T" & LastRow).Name = "nrng_Jobs"
End With
 
Upvote 0
Norie,
This resolved my problem :)
I'll have to study my named range assignments! :wink:
Thanks, TTom
 
Upvote 0
I don't actually think it was anything to do with that.

I think the problem was the unqualified reference to Range("T6000").

Could be wrong though.:)
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,172
Members
449,071
Latest member
cdnMech

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