Forms - Named Range as the RowSource

M

Michael Beckinsale

Hi All,

Is it possible to use a named range as the RowSouce property of a ComboBox
in VBA ?

If so what is the code?

I think it should be something along the lines:

Private Sub UserForm_Initialize()
With frmHR
cbxGrade.RowSource = "ActiveWorkbook.Names Name:="Grades""
End With
End Sub

I need to use named ranges as the source list is dynamic and l dont want
blanks and therefore cannot use the whole column as a RowSource reference.

All help gratefully received

Regards

Michael beckinsale
 
M

Michael Beckinsale

Toppers,

That code didn't work but many thanks as you pointed me in the right
direction! Its not usually that simple!

Everything appears to work OK using the following code:

cbxGrade.RowSource = "Grades"

Maybe it is to do with the version of Excel being used. I am on Excel 2003
Professional / WindowsXP
 
G

Guest

Interesting! I have XL2003 and both worked for me but thanks for increasing
my knowledge anyway.
 
T

Tom Ogilvy

Perhaps

cbxGrade.RowSource = Range("Grades").Address(0,0,xlA1,True)

if Grades isn't on the activesheet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top