Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Getting list data into spreadseet

I have a UserForm in which I have a List Box. The user can add items
to the list box. At the end I have to get all items from the list box
control and transfer them into a spreadsheet column.
Appreciate any help to achieve this.

Thanks,
Anand.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Getting list data into spreadseet

Sub ListBoxToCells()

Dim indexTo As Long
Dim i As Long
Dim j As Long
Dim var As Variant
'Get how many records exist within the listbox and store that into a
variable
indexTo = ListBox1.ListCount
'This will hold the List so we can go through it
var = ListBox1.List
j = 1
'The List starts at element 0 (in the array), so we'll start the i
counter there.
For i = 0 To indexTo - 1
'Print out to the Cells.
Sheet1.Cells(j, 1).Value = var(i, 0)
j = j + 1
Next i
End Sub

Hope this helps, if you wish for me to go into more detail then I shall, but
it's all fairly straight forward stuff.

"Anand" wrote:

I have a UserForm in which I have a List Box. The user can add items
to the list box. At the end I have to get all items from the list box
control and transfer them into a spreadsheet column.
Appreciate any help to achieve this.

Thanks,
Anand.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default Getting list data into spreadseet

Sub ListBoxToCells()

Dim indexTo As Long
Dim i As Long
Dim j As Long
Dim var As Variant
indexTo = ListBox1.ListCount
var = ListBox1.List
j = 1
For i = 0 To indexTo - 1
Sheet1.Cells(j, 1).Value = var(i, 0)
j = j + 1
Next i
End Sub

Heres the code without the comments as they don't stay on the right lines
when I copy and paste it into here, so I wouldn't want it not to work because
something that should be commented, isn't.



"NateBuckley" wrote:

Sub ListBoxToCells()

Dim indexTo As Long
Dim i As Long
Dim j As Long
Dim var As Variant
'Get how many records exist within the listbox and store that into a
variable
indexTo = ListBox1.ListCount
'This will hold the List so we can go through it
var = ListBox1.List
j = 1
'The List starts at element 0 (in the array), so we'll start the i
counter there.
For i = 0 To indexTo - 1
'Print out to the Cells.
Sheet1.Cells(j, 1).Value = var(i, 0)
j = j + 1
Next i
End Sub

Hope this helps, if you wish for me to go into more detail then I shall, but
it's all fairly straight forward stuff.

"Anand" wrote:

I have a UserForm in which I have a List Box. The user can add items
to the list box. At the end I have to get all items from the list box
control and transfer them into a spreadsheet column.
Appreciate any help to achieve this.

Thanks,
Anand.

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
data validation list: how do i 'force' a user to enter data from the list? showsomeidnow Excel Discussion (Misc queries) 4 May 1st 07 05:49 PM
data validation list: how do i 'force' a user to enter data from the list? showsomeidnow Excel Discussion (Misc queries) 2 April 29th 07 11:09 PM
How to view a list of data based on another list of data Adnan Excel Discussion (Misc queries) 3 April 10th 07 05:22 PM
converting vertical data list to horizontal data list tjb Excel Worksheet Functions 2 July 15th 06 02:17 AM
Last row in spreadseet Tony Wainwright[_3_] Excel Programming 6 October 16th 05 08:51 PM


All times are GMT +1. The time now is 03:18 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"