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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

TTom

Well-known Member
Joined
Jan 19, 2005
Messages
518
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
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,286
Office Version
  1. 365
Platform
  1. Windows
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
 

TTom

Well-known Member
Joined
Jan 19, 2005
Messages
518
Norie,
This resolved my problem :)
I'll have to study my named range assignments! :wink:
Thanks, TTom
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,286
Office Version
  1. 365
Platform
  1. Windows
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.:)
 

Watch MrExcel Video

Forum statistics

Threads
1,130,119
Messages
5,640,219
Members
417,131
Latest member
Seanr19871

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
Top