Looping thorugh Listboxs to populate with name range
Joel -- Thanks (I did get a bit confused, sorry), but I was trying to use the
Range Names in the Macro -- where your EXCELLANT Suggestion by-passes the
Range names going straight to the Cell References. Can the Range names be
used in the macro? If so how?
"Joel" wrote:
try the code below. Becuase your list boxes are 1 to 4 and the rows in
column K are 2 to 5 I used (i + 1).
For i = 1 To 4
ActiveSheet.OLEObjects("Listbox" & i). _
Object.AddItem Range("K" & (i + 1)).Value
Next i
"Jim May" wrote:
Joel;
In my 4 rangenames (K2:K5) List1, List2, List3, List4 I entered
111,222,333,444
I am trying to populate the 4 sheet listboxes with the numbers (RangeName
current
values) by using:
For i = 1 To 4
ActiveSheet.OLEObjects("Listbox" & i). _
Object.AddItem Range("List" & i.Value) << am getting R/T 424 Object
required
Next i
Can you assist me?
Tks, Jim
"Joel" wrote:
try this
For i = 1 To 4
ActiveSheet.OLEObjects("Listbox" & i). _
Object.AddItem "List" & i
Next i
"CmK" wrote:
Hi
I have four listboxs on one sheet how do i
loop through all the listboxs on one Worksheet then populate them with named
range
Named range are List1,List2,List3 and List4
So i need List1 to be populated in the first Listbox
then List2 to be populate into the second Listbox
etc....
Example
sub poplistboxx()
Dim listbox as object
Dim i as integer
For each listbox in activesheet
??????
Thanks in advance
|