Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Data from listbox to Excel sheet

Hi,

I have designed a UserForm which allows the user to select
specific items from a master spreadsheet. These items
with some attributes are then added to a series of
listboxes.
I would like to be able to use a command button and....

1. open a new workbook
2. put the listbox data into columns with headings
3. give the option to save the workbook with a name.

point 3 is only just on my wish list, it is the first two
points that are really causing me problems.

If anyone can help, it would be most appreciated.

Many thanks

James
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Data from listbox to Excel sheet

Dim bk as Workbook
workbooks.Add
set bk = ActiveWorkbook

i = 0
for each ctrl in Userform1.Controls
if typeof ctrl is MSforms.ListBox
i = i + 1
With bk.Worksheets(1)
.cells(2,i).Resize(ctrl.Listcount,1).Value = ctrl.list
end if
Next

' not sure where the headings would come from

fName = Application.GetSaveAsFileName()

bk.SaveAs fName
bk.Close SaveChanges:=False

might be a start.

"James Batley" wrote in message
...
Hi,

I have designed a UserForm which allows the user to select
specific items from a master spreadsheet. These items
with some attributes are then added to a series of
listboxes.
I would like to be able to use a command button and....

1. open a new workbook
2. put the listbox data into columns with headings
3. give the option to save the workbook with a name.

point 3 is only just on my wish list, it is the first two
points that are really causing me problems.

If anyone can help, it would be most appreciated.

Many thanks

James



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
Populating listbox with sheet names johnb Excel Discussion (Misc queries) 1 May 16th 08 12:33 PM
Userform Listbox using an active sheet [email protected] Excel Discussion (Misc queries) 0 March 1st 06 08:22 PM
Easy Listbox to Sheet? Noggin Excel Programming 2 June 28th 04 12:17 PM
listbox.value not equal to listbox.list(listbox.listindex,0) ARB Excel Programming 0 October 22nd 03 12:46 AM
Need listbox to choose sheet to duplicate [email protected] Excel Programming 0 September 25th 03 03:38 AM


All times are GMT +1. The time now is 07:02 PM.

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"