Add data to an existing data in a cell separate by comma from a single select listbox

masita

New Member
Joined
Aug 10, 2017
Messages
2
Hi All
Am trying to add data to an existing data in a cell separate by comma from a single select Listbox1 Userform yet the row is selected from another Listbox2 example for editing i have a add command button that suppose to add a select data to an existing data in a cell but when i do this it goes to other column. that is the code am trying
Rich (BB code):
ActiveCell.Offset(0, 5).Select 
With Worksheets("Sheet1") 
    Set ws = Worksheets("Sheet1") 
    lRow = ws.Cells(Rows.Count, 8).End(xlUp) 
     '.Offset(1, 0).Row
     '    With ws
     '   .Cells(lRow, 5).Value = Me.ListBox2.Value
     
    For y = 1 To ListBox2.ListCount + 1 
        If ListBox2.Selected(y) = True Then strListBox = strListBox & ListBox2.List(y) & " ; " 
    Next y 
    If Len(strListBox) <> 1 Then 
        strListBox = Mid(strListBox, 1, Len(strListBox) + 1) 
        .Cells(lRow, 5).Value = strListBox 
    Else 
        If Len(strListBox) = 1 Then 
            .Cells(lRow, 5).Value = " " 
        End If 
    End If
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,636
Latest member
laura12345

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