Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default list box columns not transferring


I have a multi column (4) list box with the following columns:

Botanical Name Common Name size price

the following code transferrs the columns from the list box to
separate worksheet

Private Sub CommandButton1_Click()
Dim i As Integer, x As Integer
i = 2
Sheets("sheet2").Range("a:d").EntireColumn.ClearCo ntents
With ListBox1
For x = 0 To .ListCount - 1
If .Selected(x) = True Then
Sheets("sheet2").Cells(i, 1) = .List(x, 0)
i = i + 1
End If
Next x
End With
UserForm1.Hide
End Sub


The code works however it only transferrs the 1st column "Botanica
Name" and not the other three.

How can I modify this so that it also transfers the other thre
columns. I am on a deadline for work and this is the only thing tha
is holding me up from completing my project

--
pcscs
-----------------------------------------------------------------------
pcscsr's Profile: http://www.excelforum.com/member.php...fo&userid=1200
View this thread: http://www.excelforum.com/showthread.php?threadid=27399

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default list box columns not transferring

Uh, 2 loops?

For x = 0 To .ListCount - 1
If .Selected(x) = True Then
For j = 1 To .ColumnCount
Sheets("sheet2").Cells(i, j).Value = .List(x, j - 1)
Next j
i = i + 1
End If
Next x


--

HTH

RP
(remove nothere from the email address if mailing direct)


"pcscsr" wrote in message
...

I have a multi column (4) list box with the following columns:

Botanical Name Common Name size price

the following code transferrs the columns from the list box to a
separate worksheet

Private Sub CommandButton1_Click()
Dim i As Integer, x As Integer
i = 2
Sheets("sheet2").Range("a:d").EntireColumn.ClearCo ntents
With ListBox1
For x = 0 To .ListCount - 1
If .Selected(x) = True Then
Sheets("sheet2").Cells(i, 1) = .List(x, 0)
i = i + 1
End If
Next x
End With
UserForm1.Hide
End Sub


The code works however it only transferrs the 1st column "Botanical
Name" and not the other three.

How can I modify this so that it also transfers the other three
columns. I am on a deadline for work and this is the only thing that
is holding me up from completing my project.


--
pcscsr
------------------------------------------------------------------------
pcscsr's Profile:

http://www.excelforum.com/member.php...o&userid=12006
View this thread: http://www.excelforum.com/showthread...hreadid=273998



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 validated list not transferring to Word - excel sheet Imp14 Excel Discussion (Misc queries) 0 November 19th 09 09:21 AM
Help with transferring data in one column to multiple columns. Ann New Users to Excel 2 April 23rd 07 12:36 PM
Transferring from both columns of a listbox to another Edward Excel Discussion (Misc queries) 1 February 22nd 07 02:34 AM
Lookup of Cells and transferring them to make a list Dan Excel Worksheet Functions 5 July 2nd 06 03:35 PM
List box with 2 columns Nath Excel Programming 4 May 13th 04 10:38 AM


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