ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ComboBox RowSource Question (https://www.excelbanter.com/excel-programming/369921-combobox-rowsource-question.html)

Mike Samyn

ComboBox RowSource Question
 
For a given form can I reference multiple sheets within a workbook? Here is
what I tried to do but it failed on the second ComboBox.

....
ComboBox1.RowSource = Sheets("Sheet1").Range(Cells(1,1),Cells(10,3).Addr ess
.....
.....

ComboBox2.RowSource = Sheets("Sheet2").Range(Cells(1,1),Cells(10,3).Addr ess


Thanks
Mike

Ron de Bruin

ComboBox RowSource Question
 
Hi Mike

I miss one )

And Cells use the cells on the activesheet now so you must use it like this

Sheets("Sheet2").Range(Sheets("Sheet2").Cells(1, 1), Sheets("Sheet2").Cells(10, 3)).Address



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Mike Samyn" wrote in message ...
For a given form can I reference multiple sheets within a workbook? Here is
what I tried to do but it failed on the second ComboBox.

...
ComboBox1.RowSource = Sheets("Sheet1").Range(Cells(1,1),Cells(10,3).Addr ess
....
....

ComboBox2.RowSource = Sheets("Sheet2").Range(Cells(1,1),Cells(10,3).Addr ess


Thanks
Mike




Mike Samyn

ComboBox RowSource Question
 
Ron,

I not sure I fully understand but I think what your'e telling me is that the
range refence refers to the active sheet only. I haven't tried this yet but
what if I switch active sheets between combox setups. Would that then allow
me to have multiple combo boxs ref. multiple sheet concurently?

--
Mike


"Ron de Bruin" wrote:

Hi Mike

I miss one )

And Cells use the cells on the activesheet now so you must use it like this

Sheets("Sheet2").Range(Sheets("Sheet2").Cells(1, 1), Sheets("Sheet2").Cells(10, 3)).Address



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Mike Samyn" wrote in message ...
For a given form can I reference multiple sheets within a workbook? Here is
what I tried to do but it failed on the second ComboBox.

...
ComboBox1.RowSource = Sheets("Sheet1").Range(Cells(1,1),Cells(10,3).Addr ess
....
....

ComboBox2.RowSource = Sheets("Sheet2").Range(Cells(1,1),Cells(10,3).Addr ess


Thanks
Mike





Ron de Bruin

ComboBox RowSource Question
 
You must always refer to the correct sheet with Cells
You can run the code thern with any sheet active

With Sheets("Sheet2")
ComboBox2.RowSource = .Range(.Cells(1, 1), .Cells(10, 3)).Address
End With


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Mike Samyn" wrote in message ...
Ron,

I not sure I fully understand but I think what your'e telling me is that the
range refence refers to the active sheet only. I haven't tried this yet but
what if I switch active sheets between combox setups. Would that then allow
me to have multiple combo boxs ref. multiple sheet concurently?

--
Mike


"Ron de Bruin" wrote:

Hi Mike

I miss one )

And Cells use the cells on the activesheet now so you must use it like this

Sheets("Sheet2").Range(Sheets("Sheet2").Cells(1, 1), Sheets("Sheet2").Cells(10, 3)).Address



--
Regards Ron de Bruin
http://www.rondebruin.nl



"Mike Samyn" wrote in message ...
For a given form can I reference multiple sheets within a workbook? Here is
what I tried to do but it failed on the second ComboBox.

...
ComboBox1.RowSource = Sheets("Sheet1").Range(Cells(1,1),Cells(10,3).Addr ess
....
....

ComboBox2.RowSource = Sheets("Sheet2").Range(Cells(1,1),Cells(10,3).Addr ess


Thanks
Mike








All times are GMT +1. The time now is 04:25 PM.

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