ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I set the rowsource for a ComboBox for a dynamic list? (https://www.excelbanter.com/excel-programming/341439-how-do-i-set-rowsource-combobox-dynamic-list.html)

ndm berry[_2_]

How do I set the rowsource for a ComboBox for a dynamic list?
 
I have a ComboBox on a UserForm that relates to a list which is updated every
time the workbook is opened. At the moment, so that I can carry on with
other aspects, I have set the rowSource as follows:-

ComboBox1.RowSource = "A1:B456"

This of course is only temporary and I would appreciate a more permanent
solution.

Many thanks in advance.

Tom Ogilvy

How do I set the rowsource for a ComboBox for a dynamic list?
 
Just guessing

With Worksheets("Sheet3")
set rng = .Range(.range("A1"),.Range("A1").end(xldown))
End with
rng.Resize(,2)
Combobox1.ColumnCount = 2
Combobox1.RowSource = rng.Address(external:=True)

--
Regards,
Tom Ogilvy

"ndm berry" wrote in message
...
I have a ComboBox on a UserForm that relates to a list which is updated

every
time the workbook is opened. At the moment, so that I can carry on with
other aspects, I have set the rowSource as follows:-

ComboBox1.RowSource = "A1:B456"

This of course is only temporary and I would appreciate a more permanent
solution.

Many thanks in advance.




ndm berry[_2_]

How do I set the rowsource for a ComboBox for a dynamic list?
 
Thanks for trying, unfortunately I get a syntax error on the line

rng.Resize(,2)

"Tom Ogilvy" wrote:

Just guessing

With Worksheets("Sheet3")
set rng = .Range(.range("A1"),.Range("A1").end(xldown))
End with
rng.Resize(,2)
Combobox1.ColumnCount = 2
Combobox1.RowSource = rng.Address(external:=True)

--
Regards,
Tom Ogilvy

"ndm berry" wrote in message
...
I have a ComboBox on a UserForm that relates to a list which is updated

every
time the workbook is opened. At the moment, so that I can carry on with
other aspects, I have set the rowSource as follows:-

ComboBox1.RowSource = "A1:B456"

This of course is only temporary and I would appreciate a more permanent
solution.

Many thanks in advance.





Tom Ogilvy

How do I set the rowsource for a ComboBox for a dynamic list?
 
should be

set rng = rng.Resize(,2)

--
Regards,
Tom Ogilvy

"ndm berry" wrote in message
...
Thanks for trying, unfortunately I get a syntax error on the line

rng.Resize(,2)

"Tom Ogilvy" wrote:

Just guessing

With Worksheets("Sheet3")
set rng = .Range(.range("A1"),.Range("A1").end(xldown))
End with
rng.Resize(,2)
Combobox1.ColumnCount = 2
Combobox1.RowSource = rng.Address(external:=True)

--
Regards,
Tom Ogilvy

"ndm berry" wrote in message
...
I have a ComboBox on a UserForm that relates to a list which is

updated
every
time the workbook is opened. At the moment, so that I can carry on

with
other aspects, I have set the rowSource as follows:-

ComboBox1.RowSource = "A1:B456"

This of course is only temporary and I would appreciate a more

permanent
solution.

Many thanks in advance.







ndm berry[_2_]

How do I set the rowsource for a ComboBox for a dynamic list?
 
Thank you very much it worked a treat!

"Tom Ogilvy" wrote:

should be

set rng = rng.Resize(,2)

--
Regards,
Tom Ogilvy

"ndm berry" wrote in message
...
Thanks for trying, unfortunately I get a syntax error on the line

rng.Resize(,2)

"Tom Ogilvy" wrote:

Just guessing

With Worksheets("Sheet3")
set rng = .Range(.range("A1"),.Range("A1").end(xldown))
End with
rng.Resize(,2)
Combobox1.ColumnCount = 2
Combobox1.RowSource = rng.Address(external:=True)

--
Regards,
Tom Ogilvy

"ndm berry" wrote in message
...
I have a ComboBox on a UserForm that relates to a list which is

updated
every
time the workbook is opened. At the moment, so that I can carry on

with
other aspects, I have set the rowSource as follows:-

ComboBox1.RowSource = "A1:B456"

This of course is only temporary and I would appreciate a more

permanent
solution.

Many thanks in advance.








All times are GMT +1. The time now is 05:54 PM.

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