selecting data from a list box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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
 
thanks bob, I copied your code exactley but I am getting an error message
"Invalid use of ME keyword" still. any suggestions?
 
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..
 
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.
 
And you got more responses in .misc.
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top