View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.programming
Ronbo Ronbo is offline
external usenet poster
 
Posts: 162
Default Transfering Data from ListBox to Worksheet



"Dick Kusleika" wrote:

Ronbo

Well, Dave was right. I thought the Value property of the Listbox would
give you an error in a mulitselect listbox, but it's just Null.

First, Sheet1 is the CodeName of the sheet, not the name. Sheet1's name is
RESULTS. Sheet2's name is "Sheet1" Look at the Project Explorer (Cntl+R)
to see how that works.

Here's the code that you need

Private Sub OKButton_Click()

Dim i As Long

For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
Worksheets("Sheet1").Range("B43").End(xlUp) _
.Offset(1, 0).Value = Me.ListBox1.List(i)
End If
Next i

Unload Me

End Sub

That looks like a very useful spreadsheet you're building.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com


Ronbo wrote:
"Dave Peterson" wrote:

Dick's address is in the header:

"Dick Kusleika"

ps. When I turned off smart quotes in MSWord, it fixed the apostrophe
problem, too.

Your apostrophes still look funny.

Ronbo wrote:
<<snipped

What is your e-mail address? If you want you can e-mail it to me at
ronbowman32@aol.
Its 10:30 CT. I will be back in about two hours and will e-mail it
then if I have an address.

Thanks



--

Dave Peterson



Dave -


Thanks


Dick -


I just got your last response. I was looking for an e-mail reply and just
came back here and found you last response.

It WORKS PERFECT!!!

Thanks a lot for your help, time, patiance and expertise.

As for the sheet name, I named it sheet1 as to not make it more confusing by
changing names through this discussion.

Ronbo

P.S. Thanks a lot to Dave P. also