Listbox selection

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,059
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
I have this code, if the user selects an item from combobox5 and from listbox3 user can select multiselect option. with the current code the output is in one single cell.
Current code output:- j11 its Road:- 1,2 (considering J11 cell as last empty cell in coloum J)

Dim WaxU As String
Dim WaxI As Long
For WaxI = 0 To Me.ListBox3.ListCount - 1
If Me.ListBox3.Selected(WaxI) = True Then
If WaxU = "" Then WaxU = Me.ListBox3.List(WaxI) Else WaxU = Me.ComboBox5.Value & "-" & WaxU & ", " & Me.ListBox3.List(WaxI)
Me.ListBox3.Selected(WaxI) = False
End If
Next
ws.Range("J" & LastRow).Offset(0, 0).Value = Me.Label63.Caption & ":- " & WaxU


Is it possible or a way as the muli selection output will be one below the other --
in cell j11 Road:-1
in cell j12 Road:-2
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Maybe something like
Code:
Dim WaxU As String
Dim WaxI As Long
For WaxI = 0 To Me.ListBox3.ListCount - 1
   If Me.ListBox3.Selected(WaxI) = True Then
      ws.Range("J" & lastRow).Value = Me.ComboBox5.Value & "-" & Me.ListBox3.List(WaxI)
      lastRow = lastRow + 1
      Me.ListBox3.Selected(WaxI) = False
   End If
Next
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top