ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Easy Listbox to Sheet? (https://www.excelbanter.com/excel-programming/302651-easy-listbox-sheet.html)

Noggin

Easy Listbox to Sheet?
 
Hi M8's

Can any on guide me as to the easy way to copy the contents of a mult
column list box to a worksheet, the column & row methord look
painfully slow. Is there an easy way? Sorry if this seams to be a bi
lame.
Also how on earth do you populate the headings in a listbox afte
turning them on?

Thankx for any 11111 help:rolleyes

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy[_14_]

Easy Listbox to Sheet?
 
Dim varr as Variant

varr = me.Combobox1.List

numRows = Ubound(varr,1)-lbound(varr,1)+1
numColumns = Ubound(varr,2)-lbound(varr,2)+1

With Worksheets("Sheet9")
.Range("B9").Resize(numrows,NumColumns) = varr

End With


-----------

The columnheading can only be set by using the rowsource (userform) o
listfillrange (worksheet) Property to populate the list. If so, the
the row above the specified range is used to populate the colum
headings. If the rowsource/listfillrange starts in row1, then it use
the column letters.

You can't populate them if you don't bind the control list to th
sheet.

--
Regards,
Tom Ogilv

--
Message posted from http://www.ExcelForum.com


Noggin[_2_]

Easy Listbox to Sheet?
 
Thankx Tom,

Easy when you know how, just changed the combobox for listbox an
deimed the vars numrows, numcolumns all fine. First class!

I tried unsucessfully to get the headings in, obviously I need a bi
more pointing in the right direction. Woul;d you oblige please. Pehap
some other kind sole might enlighten me.

Thankx for the help ;

--
Message posted from http://www.ExcelForum.com



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

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