Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Filling combobox with variable length list

I have a combobox on a userform that shows a list from Sheet1. This list
varies in length week to week, so it will not always be the same number of
rows. I know how to assign a RowSource in the Properties window. I need to
know how to use VBA to accommodate the different length lists, maybe when
the form loads. I do not want any extra rows listed that are not used.

Any help is much appreciated!
Thanks,
Denny


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Filling combobox with variable length list

Hi Denny,

Try using a dynamic range.

For example, suppose your variable length list starts in A1, set the
RowSource to:

=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A,1)

---
Regards,
Norman



"Denny Behnfeldt" wrote in message
...
I have a combobox on a userform that shows a list from Sheet1. This list
varies in length week to week, so it will not always be the same number of
rows. I know how to assign a RowSource in the Properties window. I need to
know how to use VBA to accommodate the different length lists, maybe when
the form loads. I do not want any extra rows listed that are not used.

Any help is much appreciated!
Thanks,
Denny




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Filling combobox with variable length list

Denny,

Norman's formula is missing a closing ). Also, you might find it easier to
define a workbook name for this dynamic range and use that in the properties
(I find this more manageable myself).

And if you wanted to assign it at run time, when the form loads say,
assuming the range is named myRange, you can do that with

ListBox1.RowSource = Range("myRange").Address

A few options for you.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Norman Jones" wrote in message
...
Hi Denny,

Try using a dynamic range.

For example, suppose your variable length list starts in A1, set the
RowSource to:

=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A,1)

---
Regards,
Norman



"Denny Behnfeldt" wrote in message
...
I have a combobox on a userform that shows a list from Sheet1. This list
varies in length week to week, so it will not always be the same number

of
rows. I know how to assign a RowSource in the Properties window. I need

to
know how to use VBA to accommodate the different length lists, maybe

when
the form loads. I do not want any extra rows listed that are not used.

Any help is much appreciated!
Thanks,
Denny






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Filling combobox with variable length list

Hi Bob,

Norman's formula is missing a closing ).


Thanks for the catch!

---
Regards,
Norman



"Bob Phillips" wrote in message
...
Denny,

Norman's formula is missing a closing ). Also, you might find it easier to
define a workbook name for this dynamic range and use that in the
properties
(I find this more manageable myself).

And if you wanted to assign it at run time, when the form loads say,
assuming the range is named myRange, you can do that with

ListBox1.RowSource = Range("myRange").Address

A few options for you.

--

HTH

RP
(remove nothere from the email address if mailing direct)



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
Variable length of input area in a combobox Kasper Excel Discussion (Misc queries) 1 July 24th 09 01:15 PM
Transpose a variable length list into Excel / Access Table Pete New Users to Excel 11 September 13th 06 07:37 PM
searching for a combobox.value and filling in textboxes from results GregJG[_18_] Excel Programming 3 July 8th 04 12:41 PM
Filling a ComboBox? CG Rosén Excel Programming 1 July 1st 04 02:33 AM
how to? running average from a variable length list robreeve Excel Programming 1 July 28th 03 02:05 PM


All times are GMT +1. The time now is 05:33 AM.

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"