ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Write a Listbox list to a dynamic range (https://www.excelbanter.com/excel-programming/346780-write-listbox-list-dynamic-range.html)

blayne

Write a Listbox list to a dynamic range
 
I am looking for some code to write the user selections from a list box to a
dynamic worksheet range
something like
range ("rng1")= listbox1.list
and then resize the range dependent on the lengh of the list (list is 1
Column)
--
Fuzzy logix

Tom Ogilvy

Write a Listbox list to a dynamic range
 
Dim v as Variant
v = Listbox1.List
range("rng1").Resize(ubound(v,1)-lbound(v,1)+1,1).Value = v

--
Regards,
Tom Ogilvy

"blayne" wrote in message
...
I am looking for some code to write the user selections from a list box to

a
dynamic worksheet range
something like
range ("rng1")= listbox1.list
and then resize the range dependent on the lengh of the list (list is 1
Column)
--
Fuzzy logix




blayne

Write a Listbox list to a dynamic range
 
Thank you Tom,

--
Fuzzy logix


"Tom Ogilvy" wrote:

Dim v as Variant
v = Listbox1.List
range("rng1").Resize(ubound(v,1)-lbound(v,1)+1,1).Value = v

--
Regards,
Tom Ogilvy

"blayne" wrote in message
...
I am looking for some code to write the user selections from a list box to

a
dynamic worksheet range
something like
range ("rng1")= listbox1.list
and then resize the range dependent on the lengh of the list (list is 1
Column)
--
Fuzzy logix





blayne

Write a Listbox list to a dynamic range
 
Works Fine
rng1 is a named range & I want to include the new information in the named
range
--
Fuzzy logix


"Tom Ogilvy" wrote:

Dim v as Variant
v = Listbox1.List
range("rng1").Resize(ubound(v,1)-lbound(v,1)+1,1).Value = v

--
Regards,
Tom Ogilvy

"blayne" wrote in message
...
I am looking for some code to write the user selections from a list box to

a
dynamic worksheet range
something like
range ("rng1")= listbox1.list
and then resize the range dependent on the lengh of the list (list is 1
Column)
--
Fuzzy logix





Tom Ogilvy

Write a Listbox list to a dynamic range
 
Dim v as Variant
Dim rng as Range
v = Listbox1.List
set rng = range("rng1").Resize(ubound(v,1)-lbound(v,1)+1,1)
rng.Value = v
rng.Name = "rng1"

--
Regards,
Tom Ogilvy


"blayne" wrote in message
...
Works Fine
rng1 is a named range & I want to include the new information in the named
range
--
Fuzzy logix


"Tom Ogilvy" wrote:

Dim v as Variant
v = Listbox1.List
range("rng1").Resize(ubound(v,1)-lbound(v,1)+1,1).Value = v

--
Regards,
Tom Ogilvy

"blayne" wrote in message
...
I am looking for some code to write the user selections from a list

box to
a
dynamic worksheet range
something like
range ("rng1")= listbox1.list
and then resize the range dependent on the lengh of the list (list is

1
Column)
--
Fuzzy logix







blayne

Write a Listbox list to a dynamic range
 
Thank you again
I came up with something simalar but your code is cleaner ( simpler)

--
Fuzzy logix


"Tom Ogilvy" wrote:

Dim v as Variant
Dim rng as Range
v = Listbox1.List
set rng = range("rng1").Resize(ubound(v,1)-lbound(v,1)+1,1)
rng.Value = v
rng.Name = "rng1"

--
Regards,
Tom Ogilvy


"blayne" wrote in message
...
Works Fine
rng1 is a named range & I want to include the new information in the named
range
--
Fuzzy logix


"Tom Ogilvy" wrote:

Dim v as Variant
v = Listbox1.List
range("rng1").Resize(ubound(v,1)-lbound(v,1)+1,1).Value = v

--
Regards,
Tom Ogilvy

"blayne" wrote in message
...
I am looking for some code to write the user selections from a list

box to
a
dynamic worksheet range
something like
range ("rng1")= listbox1.list
and then resize the range dependent on the lengh of the list (list is

1
Column)
--
Fuzzy logix








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

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