Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
LilyDog7
 
Posts: n/a
Default selecting data from a list box

I have created a list box using the multi select function. What I would like
to do is be able to highlight multiple items(not in any particular order) in
the list box and then return their selection to cells M1, M2, M3 and so on.

I tried writing in a macro code to do this but it didn't seem to help. I
got the code from a previous posting but kep getting an error message about
the ME function:
Dim i As Long
Dim j As Long
With.Me.ListBox1
For i= 0 To .List Count -1
If.Selected(i) Then
j=j + 1
me.range("A" & j).Value = .List(i)
End If
Next i
end With
End Sub

Does anyone out there have any suggestions for someone new to excel? Thank
you!
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Dim i As Long
Dim j As Long
With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
j = j + 1
ActiveSheet.Range("M" & j).Value = .List(i)
End If
Next i
End With


--
HTH

Bob Phillips

"LilyDog7" wrote in message
...
I have created a list box using the multi select function. What I would

like
to do is be able to highlight multiple items(not in any particular order)

in
the list box and then return their selection to cells M1, M2, M3 and so

on.

I tried writing in a macro code to do this but it didn't seem to help. I
got the code from a previous posting but kep getting an error message

about
the ME function:
Dim i As Long
Dim j As Long
With.Me.ListBox1
For i= 0 To .List Count -1
If.Selected(i) Then
j=j + 1
me.range("A" & j).Value = .List(i)
End If
Next i
end With
End Sub

Does anyone out there have any suggestions for someone new to excel? Thank
you!



  #3   Report Post  
LilyDog7
 
Posts: n/a
Default

thanks bob, I copied your code exactley but I am getting an error message
"Invalid use of ME keyword" still. any suggestions?

"Bob Phillips" wrote:

Dim i As Long
Dim j As Long
With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
j = j + 1
ActiveSheet.Range("M" & j).Value = .List(i)
End If
Next i
End With


--
HTH

Bob Phillips

"LilyDog7" wrote in message
...
I have created a list box using the multi select function. What I would

like
to do is be able to highlight multiple items(not in any particular order)

in
the list box and then return their selection to cells M1, M2, M3 and so

on.

I tried writing in a macro code to do this but it didn't seem to help. I
got the code from a previous posting but kep getting an error message

about
the ME function:
Dim i As Long
Dim j As Long
With.Me.ListBox1
For i= 0 To .List Count -1
If.Selected(i) Then
j=j + 1
me.range("A" & j).Value = .List(i)
End If
Next i
end With
End Sub

Does anyone out there have any suggestions for someone new to excel? Thank
you!




  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Is the listbox on a worksheet, I assumed it was on a userform? If it is not
a userform, your code means that it must be a Control Toolbox listbox, and
therefore it should be stored in the worksheet code module, and Me will work
fine then..

--
HTH

Bob Phillips

"LilyDog7" wrote in message
...
thanks bob, I copied your code exactley but I am getting an error message
"Invalid use of ME keyword" still. any suggestions?

"Bob Phillips" wrote:

Dim i As Long
Dim j As Long
With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
j = j + 1
ActiveSheet.Range("M" & j).Value = .List(i)
End If
Next i
End With


--
HTH

Bob Phillips

"LilyDog7" wrote in message
...
I have created a list box using the multi select function. What I

would
like
to do is be able to highlight multiple items(not in any particular

order)
in
the list box and then return their selection to cells M1, M2, M3 and

so
on.

I tried writing in a macro code to do this but it didn't seem to help.

I
got the code from a previous posting but kep getting an error message

about
the ME function:
Dim i As Long
Dim j As Long
With.Me.ListBox1
For i= 0 To .List Count -1
If.Selected(i) Then
j=j + 1
me.range("A" & j).Value = .List(i)
End If
Next i
end With
End Sub

Does anyone out there have any suggestions for someone new to excel?

Thank
you!






  #5   Report Post  
LilyDog7
 
Posts: n/a
Default

thanks that did work! now using the control toolbox list form, is there a
way i can highlight multiple items from a listbox and have them listed in
cell M!, M2 M3 etc...? right now the way it is set up, i can only highlight 1
item at atime.

"Bob Phillips" wrote:

Dim i As Long
Dim j As Long
With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
j = j + 1
ActiveSheet.Range("M" & j).Value = .List(i)
End If
Next i
End With


--
HTH

Bob Phillips

"LilyDog7" wrote in message
...
I have created a list box using the multi select function. What I would

like
to do is be able to highlight multiple items(not in any particular order)

in
the list box and then return their selection to cells M1, M2, M3 and so

on.

I tried writing in a macro code to do this but it didn't seem to help. I
got the code from a previous posting but kep getting an error message

about
the ME function:
Dim i As Long
Dim j As Long
With.Me.ListBox1
For i= 0 To .List Count -1
If.Selected(i) Then
j=j + 1
me.range("A" & j).Value = .List(i)
End If
Next i
end With
End Sub

Does anyone out there have any suggestions for someone new to excel? Thank
you!






  #6   Report Post  
Bob Phillips
 
Posts: n/a
Default

You have to set the MultiSelect property to fmMultiSelectMulti

--
HTH

Bob Phillips

"LilyDog7" wrote in message
...
thanks that did work! now using the control toolbox list form, is there a
way i can highlight multiple items from a listbox and have them listed in
cell M!, M2 M3 etc...? right now the way it is set up, i can only

highlight 1
item at atime.

"Bob Phillips" wrote:

Dim i As Long
Dim j As Long
With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
j = j + 1
ActiveSheet.Range("M" & j).Value = .List(i)
End If
Next i
End With


--
HTH

Bob Phillips

"LilyDog7" wrote in message
...
I have created a list box using the multi select function. What I

would
like
to do is be able to highlight multiple items(not in any particular

order)
in
the list box and then return their selection to cells M1, M2, M3 and

so
on.

I tried writing in a macro code to do this but it didn't seem to help.

I
got the code from a previous posting but kep getting an error message

about
the ME function:
Dim i As Long
Dim j As Long
With.Me.ListBox1
For i= 0 To .List Count -1
If.Selected(i) Then
j=j + 1
me.range("A" & j).Value = .List(i)
End If
Next i
end With
End Sub

Does anyone out there have any suggestions for someone new to excel?

Thank
you!






  #7   Report Post  
Dave Peterson
 
Posts: n/a
Default

And you got more responses in .misc.

LilyDog7 wrote:

I have created a list box using the multi select function. What I would like
to do is be able to highlight multiple items(not in any particular order) in
the list box and then return their selection to cells M1, M2, M3 and so on.

I tried writing in a macro code to do this but it didn't seem to help. I
got the code from a previous posting but kep getting an error message about
the ME function:
Dim i As Long
Dim j As Long
With.Me.ListBox1
For i= 0 To .List Count -1
If.Selected(i) Then
j=j + 1
me.range("A" & j).Value = .List(i)
End If
Next i
end With
End Sub

Does anyone out there have any suggestions for someone new to excel? Thank
you!


--

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
Expanding Data validation from List mark hansen Excel Discussion (Misc queries) 2 September 4th 05 01:39 AM
How do I get LIST on the DATA menu bar-I need Create List paintedruby New Users to Excel 1 July 26th 05 03:47 AM
subtotaling and manipulating a list of data TJN Excel Worksheet Functions 0 April 27th 05 11:17 PM
subtotaling and manipulating a list of data TJN Excel Worksheet Functions 0 April 27th 05 10:31 PM
Using Validation List from Another Workbook with Dependent Data Mike R. Excel Worksheet Functions 5 January 8th 05 07:06 PM


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