Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Forms - Named Range as the RowSource

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Forms - Named Range as the RowSource

Hi,

cbxGrade.RowSource = Range("Grades").Address

"Michael Beckinsale" wrote:

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Forms - Named Range as the RowSource

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

"Toppers" wrote in message
...
Hi,

cbxGrade.RowSource = Range("Grades").Address

"Michael Beckinsale" wrote:

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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Forms - Named Range as the RowSource

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

"Michael Beckinsale" wrote:

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

"Toppers" wrote in message
...
Hi,

cbxGrade.RowSource = Range("Grades").Address

"Michael Beckinsale" wrote:

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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Forms - Named Range as the RowSource

Perhaps

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

if Grades isn't on the activesheet

--
Regards,
Tom Ogilvy


"Toppers" wrote in message
...
Interesting! I have XL2003 and both worked for me but thanks for

increasing
my knowledge anyway.

"Michael Beckinsale" wrote:

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

"Toppers" wrote in message
...
Hi,

cbxGrade.RowSource = Range("Grades").Address

"Michael Beckinsale" wrote:

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








Reply
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
If any cell in named range = 8 then shade named range JJ[_8_] Excel Programming 3 August 26th 05 11:09 PM
problem assigning range returned by function, to combobox rowsource Kate Excel Programming 6 August 26th 05 02:28 PM
Dynamic range not resized for RowSource usage Tim Zych[_8_] Excel Programming 3 August 9th 04 02:08 AM
Listbox Rowsource Headings Multi columns Copy Range If Then Conditional hgdev Excel Programming 0 February 27th 04 05:27 PM
ComboBox RowSource --- can I use a userform OWC10 spreadsheet range? Dean Frazier Excel Programming 0 February 11th 04 07:16 PM


All times are GMT +1. The time now is 11:47 PM.

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

About Us

"It's about Microsoft Excel"