Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Need help with MultiSelect List Box

Hi,

Can anyone help me. I am quite new to VBA and need some help taking
data from a list box that has multiple entires and inserting the entire
list into a range of cells.

I can tie one cell to the list box but not the entire list to a range

Thanks so much

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Need help with MultiSelect List Box

Is this a listbox on a userform?

Or is this a listbox on a worksheet? If it's on a worksheet, did you use the
listbox from the Forms toolbar or from the Control Toolbox toolbar?

Mulberry wrote:

Hi,

Can anyone help me. I am quite new to VBA and need some help taking
data from a list box that has multiple entires and inserting the entire
list into a range of cells.

I can tie one cell to the list box but not the entire list to a range

Thanks so much


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Need help with MultiSelect List Box

Its a list box from the Control Toolbox on a worksheet.


Dave Peterson wrote:
Is this a listbox on a userform?

Or is this a listbox on a worksheet? If it's on a worksheet, did you use the
listbox from the Forms toolbar or from the Control Toolbox toolbar?

Mulberry wrote:

Hi,

Can anyone help me. I am quite new to VBA and need some help taking
data from a list box that has multiple entires and inserting the entire
list into a range of cells.

I can tie one cell to the list box but not the entire list to a range

Thanks so much


--

Dave Peterson


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Need help with MultiSelect List Box

I put a commandbutton from that same toolbar on the worksheet. And I used this
code:

Option Explicit
Private Sub CommandButton1_Click()
Dim iCtr As Long
Dim DestCell As Range

Set DestCell = Me.Range("a1")

With Me.ListBox1
DestCell.Resize(.ListCount, 1).ClearContents
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
DestCell.Value = .List(iCtr)
Set DestCell = DestCell.Offset(1, 0)
End If
Next iCtr
End With
End Sub
'create some data
Private Sub Worksheet_Activate()
Dim iCtr As Long
With Me.ListBox1
.MultiSelect = fmMultiSelectMulti
For iCtr = 0 To 9
.AddItem "A" & iCtr
Next iCtr
End With
End Sub

Mulberry wrote:

Its a list box from the Control Toolbox on a worksheet.

Dave Peterson wrote:
Is this a listbox on a userform?

Or is this a listbox on a worksheet? If it's on a worksheet, did you use the
listbox from the Forms toolbar or from the Control Toolbox toolbar?

Mulberry wrote:

Hi,

Can anyone help me. I am quite new to VBA and need some help taking
data from a list box that has multiple entires and inserting the entire
list into a range of cells.

I can tie one cell to the list box but not the entire list to a range

Thanks so much


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Need help with MultiSelect List Box

Thanks for this, appreciate the help. Only thing is that I used this
code with referencing the applicable Range and ListBox but it does not
seem to be doing anything. Any suggestions?
Dave Peterson wrote:
I put a commandbutton from that same toolbar on the worksheet. And I used this
code:

Option Explicit
Private Sub CommandButton1_Click()
Dim iCtr As Long
Dim DestCell As Range

Set DestCell = Me.Range("a1")

With Me.ListBox1
DestCell.Resize(.ListCount, 1).ClearContents
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
DestCell.Value = .List(iCtr)
Set DestCell = DestCell.Offset(1, 0)
End If
Next iCtr
End With
End Sub
'create some data
Private Sub Worksheet_Activate()
Dim iCtr As Long
With Me.ListBox1
.MultiSelect = fmMultiSelectMulti
For iCtr = 0 To 9
.AddItem "A" & iCtr
Next iCtr
End With
End Sub

Mulberry wrote:

Its a list box from the Control Toolbox on a worksheet.

Dave Peterson wrote:
Is this a listbox on a userform?

Or is this a listbox on a worksheet? If it's on a worksheet, did you use the
listbox from the Forms toolbar or from the Control Toolbox toolbar?

Mulberry wrote:

Hi,

Can anyone help me. I am quite new to VBA and need some help taking
data from a list box that has multiple entires and inserting the entire
list into a range of cells.

I can tie one cell to the list box but not the entire list to a range

Thanks so much

--

Dave Peterson


--

Dave Peterson




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Need help with MultiSelect List Box

The code that did the work was assigned to commandbutton1. Did you add a
commandbutton from the control toolbox toolbar to the worksheet?

And did you click on that button to do the work?

Mulberry wrote:

Thanks for this, appreciate the help. Only thing is that I used this
code with referencing the applicable Range and ListBox but it does not
seem to be doing anything. Any suggestions?
Dave Peterson wrote:
I put a commandbutton from that same toolbar on the worksheet. And I used this
code:

Option Explicit
Private Sub CommandButton1_Click()
Dim iCtr As Long
Dim DestCell As Range

Set DestCell = Me.Range("a1")

With Me.ListBox1
DestCell.Resize(.ListCount, 1).ClearContents
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) = True Then
DestCell.Value = .List(iCtr)
Set DestCell = DestCell.Offset(1, 0)
End If
Next iCtr
End With
End Sub
'create some data
Private Sub Worksheet_Activate()
Dim iCtr As Long
With Me.ListBox1
.MultiSelect = fmMultiSelectMulti
For iCtr = 0 To 9
.AddItem "A" & iCtr
Next iCtr
End With
End Sub

Mulberry wrote:

Its a list box from the Control Toolbox on a worksheet.

Dave Peterson wrote:
Is this a listbox on a userform?

Or is this a listbox on a worksheet? If it's on a worksheet, did you use the
listbox from the Forms toolbar or from the Control Toolbox toolbar?

Mulberry wrote:

Hi,

Can anyone help me. I am quite new to VBA and need some help taking
data from a list box that has multiple entires and inserting the entire
list into a range of cells.

I can tie one cell to the list box but not the entire list to a range

Thanks so much

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
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 do I create a multiselect drop down list Yve Excel Worksheet Functions 2 January 22nd 09 07:29 PM
Multiselect List Box Bill[_30_] Excel Programming 1 February 23rd 06 05:00 PM
List Box Multiselect Form ann_nyc Excel Programming 5 October 12th 05 07:03 PM
List Box - MultiSelect Bill[_28_] Excel Programming 2 January 31st 05 10:31 PM
Multiselect list box ptaylor[_2_] Excel Programming 5 January 28th 05 05:35 PM


All times are GMT +1. The time now is 08:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"