ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel 97 VBA: Binding a combo to a named range (https://www.excelbanter.com/excel-programming/279856-excel-97-vba-binding-combo-named-range.html)

David

Excel 97 VBA: Binding a combo to a named range
 
In the past when using combo boxes I've added items to
them using the add method.

I'd like to reference a named range from a separate stand
alone spreadsheet, so that I can provide a combobox that
has values that can be maintained separately.

I can't work out how one binds a combo in this way? Can
anyone help?


Many thanks


David

Vasant Nanavati

Excel 97 VBA: Binding a combo to a named range
 
Hi David:

Just right-click on the ComboBox to access its properties, and then set the
RowSource (or ListFillRange) property to the string rpresenting the source
range address. Or, in code:

ComboBox1.RowSource = "Sheet2!A1:A10"

Regards,

Vasant.


"David" wrote in message
...
In the past when using combo boxes I've added items to
them using the add method.

I'd like to reference a named range from a separate stand
alone spreadsheet, so that I can provide a combobox that
has values that can be maintained separately.

I can't work out how one binds a combo in this way? Can
anyone help?


Many thanks


David




David

Excel 97 VBA: Binding a combo to a named range
 
Thanks very much Vasant.

I can get that to work but I was trying to reference a
named range. This is what I've got but it doesn't work:
ComboBox1.RowSource = Range("test")

"test" is the name of a range in the current book. Ideally
I would like to reference a range in a separate standalone
book.

-----Original Message-----
Hi David:

Just right-click on the ComboBox to access its

properties, and then set the
RowSource (or ListFillRange) property to the string

rpresenting the source
range address. Or, in code:

ComboBox1.RowSource = "Sheet2!A1:A10"

Regards,

Vasant.


"David" wrote in

message
...
In the past when using combo boxes I've added items to
them using the add method.

I'd like to reference a named range from a separate

stand
alone spreadsheet, so that I can provide a combobox that
has values that can be maintained separately.

I can't work out how one binds a combo in this way? Can
anyone help?


Many thanks


David



.


steve

Excel 97 VBA: Binding a combo to a named range
 
David,

Need to use a String
ComboBox1.RowSource = Range("test").Address

May need to qualify the worksheet
ComboBox1.RowSource = Sheets("Sheet1").Range("test").Address

--
sb
"David" wrote in message
...
Thanks very much Vasant.

I can get that to work but I was trying to reference a
named range. This is what I've got but it doesn't work:
ComboBox1.RowSource = Range("test")

"test" is the name of a range in the current book. Ideally
I would like to reference a range in a separate standalone
book.

-----Original Message-----
Hi David:

Just right-click on the ComboBox to access its

properties, and then set the
RowSource (or ListFillRange) property to the string

rpresenting the source
range address. Or, in code:

ComboBox1.RowSource = "Sheet2!A1:A10"

Regards,

Vasant.


"David" wrote in

message
...
In the past when using combo boxes I've added items to
them using the add method.

I'd like to reference a named range from a separate

stand
alone spreadsheet, so that I can provide a combobox that
has values that can be maintained separately.

I can't work out how one binds a combo in this way? Can
anyone help?


Many thanks


David



.




Dave Peterson[_3_]

Excel 97 VBA: Binding a combo to a named range
 
ComboBox1.RowSource = Sheets("Sheet1").Range("test").Address(external:=t rue)

Will include the worksheet name in the string. (along with the workbook name,
too.)

steve wrote:

David,

Need to use a String
ComboBox1.RowSource = Range("test").Address

May need to qualify the worksheet
ComboBox1.RowSource = Sheets("Sheet1").Range("test").Address

--
sb
"David" wrote in message
...
Thanks very much Vasant.

I can get that to work but I was trying to reference a
named range. This is what I've got but it doesn't work:
ComboBox1.RowSource = Range("test")

"test" is the name of a range in the current book. Ideally
I would like to reference a range in a separate standalone
book.

-----Original Message-----
Hi David:

Just right-click on the ComboBox to access its

properties, and then set the
RowSource (or ListFillRange) property to the string

rpresenting the source
range address. Or, in code:

ComboBox1.RowSource = "Sheet2!A1:A10"

Regards,

Vasant.


"David" wrote in

message
...
In the past when using combo boxes I've added items to
them using the add method.

I'd like to reference a named range from a separate

stand
alone spreadsheet, so that I can provide a combobox that
has values that can be maintained separately.

I can't work out how one binds a combo in this way? Can
anyone help?


Many thanks


David


.


--

Dave Peterson


David Burr

Excel 97 VBA: Binding a combo to a named range
 
Thanks very much guys


"Dave Peterson" wrote in message
...
ComboBox1.RowSource =

Sheets("Sheet1").Range("test").Address(external:=t rue)

Will include the worksheet name in the string. (along with the workbook

name,
too.)

steve wrote:

David,

Need to use a String
ComboBox1.RowSource = Range("test").Address

May need to qualify the worksheet
ComboBox1.RowSource = Sheets("Sheet1").Range("test").Address

--
sb
"David" wrote in message
...
Thanks very much Vasant.

I can get that to work but I was trying to reference a
named range. This is what I've got but it doesn't work:
ComboBox1.RowSource = Range("test")

"test" is the name of a range in the current book. Ideally
I would like to reference a range in a separate standalone
book.

-----Original Message-----
Hi David:

Just right-click on the ComboBox to access its
properties, and then set the
RowSource (or ListFillRange) property to the string
rpresenting the source
range address. Or, in code:

ComboBox1.RowSource = "Sheet2!A1:A10"

Regards,

Vasant.


"David" wrote in
message
...
In the past when using combo boxes I've added items to
them using the add method.

I'd like to reference a named range from a separate
stand
alone spreadsheet, so that I can provide a combobox that
has values that can be maintained separately.

I can't work out how one binds a combo in this way? Can
anyone help?


Many thanks


David


.


--

Dave Peterson





All times are GMT +1. The time now is 10:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com