Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default User form with a listbox

Kimberly,

Use the Selected property to test that an item has been selected:

Private Sub CommandButton1_Click()
Dim i As Integer

With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
MsgBox .List(i)
End If
Next i
End With
End Sub


--

John Green - Excel MVP
Sydney
Australia


"KimberlyC" wrote in message ...
Hi
I have created a User from with a List box. The listbox is populated from a
range (V14:V25) on my worksheet.
The listbox is set to multi select the items.
I want to have the user select the items, and when they click the OK button
on the form... the items selected will copy or go to a range called
"headers" on a worksheet 2.
I'm not sure of the code to use to get those selected items to that range
when the user clicks the ok button.

Any suggestions would be greatly appreciated.

Thanks,
Kimberly




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default User form with a listbox

Thank you!

How do I take those selected items and copy them to a different range on a
worksheet?


"John Green" wrote in message
...
Kimberly,

Use the Selected property to test that an item has been selected:

Private Sub CommandButton1_Click()
Dim i As Integer

With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
MsgBox .List(i)
End If
Next i
End With
End Sub


--

John Green - Excel MVP
Sydney
Australia


"KimberlyC" wrote in message

...
Hi
I have created a User from with a List box. The listbox is populated

from a
range (V14:V25) on my worksheet.
The listbox is set to multi select the items.
I want to have the user select the items, and when they click the OK

button
on the form... the items selected will copy or go to a range called
"headers" on a worksheet 2.
I'm not sure of the code to use to get those selected items to that

range
when the user clicks the ok button.

Any suggestions would be greatly appreciated.

Thanks,
Kimberly






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default User form with a listbox

To place the selected values in a column, starting in B1:

Private Sub CommandButton1_Click()
Dim i As Integer
Dim j As Integer

With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
Range("B1").Offset(j, 0).Value = .List(i)
j = j + 1
End If
Next i
End With
End Sub


--

John Green - Excel MVP
Sydney
Australia


"KimberlyC" wrote in message ...
Thank you!

How do I take those selected items and copy them to a different range on a
worksheet?


"John Green" wrote in message
...
Kimberly,

Use the Selected property to test that an item has been selected:

Private Sub CommandButton1_Click()
Dim i As Integer

With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
MsgBox .List(i)
End If
Next i
End With
End Sub


--

John Green - Excel MVP
Sydney
Australia


"KimberlyC" wrote in message

...
Hi
I have created a User from with a List box. The listbox is populated

from a
range (V14:V25) on my worksheet.
The listbox is set to multi select the items.
I want to have the user select the items, and when they click the OK

button
on the form... the items selected will copy or go to a range called
"headers" on a worksheet 2.
I'm not sure of the code to use to get those selected items to that

range
when the user clicks the ok button.

Any suggestions would be greatly appreciated.

Thanks,
Kimberly








  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default User form with a listbox

How did you set your list or reange to "Multi Select". I am going nut
trying to just do that. If you can, please outline the steps for me

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default User form with a listbox

right click
Properties
Multiselect property - set to true.

--
Regards,
Tom Ogilvy

"Wango" wrote in message
...
How did you set your list or reange to "Multi Select". I am going nuts
trying to just do that. If you can, please outline the steps for me.


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



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
How to filter listbox data in a form? Vinod Excel Discussion (Misc queries) 1 January 11th 10 02:01 PM
user form Jase Excel Discussion (Misc queries) 1 March 25th 08 09:51 PM
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
Multi-field listbox in an Excel form Lee S. Excel Discussion (Misc queries) 0 September 14th 06 10:19 PM
Help On User Form mastee Excel Discussion (Misc queries) 4 August 23rd 05 12:31 PM


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