MobileMobile | Continue

Excel Bar

Excel Bar

Your excel questions will be responsed by our excel experts within 24hrs.Our service is free.

 Forgot Pass?
 Register Now
Find
Hot Search: Vlookup Match VBA
12
Return Post new threads
Author: ricklou

Listbox update multiple items in Listbox

[Copy link]

3

Topics

110

Posts

255

Integral

Conqueror

Rank: 3Rank: 3

Integral
255
Post on 2-11-2017 19:36:59 | All posts



ricklou,
It is not very clear how you want the selected values entered on the sheet.  I will interpret you to mean that you want them appended in the cell (ex. 1|2|3).  The example uses a pipe as the separator.  To do this, please change add the code lines in blue
Private Sub update_Click()
Dim no, rowNO, i, r As Integer,
[color=]stng As String
Dim dat As Date
If Label8.Caption =  Then
    MsgBox Please choose value!
    Exit Sub
End If
If ComboBox1.Value =  Then
    MsgBox Please choose option!
End If
r = 0
no = CInt(Label8.Caption)
rowNO = Application.WorksheetFunction.Match(no, Sheets(Database).Range(A:A), 0)
  For i = 8 To 377
     If Worksheets(Database).Cells(3, i) = DTPicker1.Value And Worksheets(Database).Cells(3, i) = DTPicker2.Value Then
        
'Worksheets(Database).Cells(rowNO, i) = LbNumbers.List(LbNumbers.ListIndex)
        
[color=]For j = 0 To LbNumbers.ListCount - 1
            If LbNumbers.Selected(j) Then
                If stng =  Then
                    stng = LbNumbers.List(j)
                Else
                    stng = stng  |  LbNumbers.List(j)
                End If
            End If
        Next j
        Worksheets(Database).Cells(rowNO, i) = stng
        stng =
        r = 1
     End If
  Next I
If r = 0 Then MsgBox No updates made. Check data!
End SubHTH,
Maud




Reply Support Opposition

Props Report

20

Topics

89

Posts

236

Integral

Conqueror

Rank: 3Rank: 3

Integral
236
 Author| Post on 2-11-2017 20:55:55 | All posts




Maud my bad it should go down like this
1
2
3
The datepicker will align it on the correct day.Maud gonna test it quickly and I will revert back.Thank you very much for the code supplied.Going to test it quickly




Reply Support Opposition

Props Report

20

Topics

89

Posts

236

Integral

Conqueror

Rank: 3Rank: 3

Integral
236
 Author| Post on 2-11-2017 21:56:35 | All posts



Maud well done its posting it but like I have mentioned it should be posted like
1
2
3
1 number in each row going down

If its like that its perfect thank you very very much its 99.9% there.
Reply Support Opposition

Props Report

20

Topics

89

Posts

236

Integral

Conqueror

Rank: 3Rank: 3

Integral
236
 Author| Post on 2-11-2017 20:57:33 | All posts





Kasan thank you for your reply sure.......this is a solution you did for someone. So credit for this code is to you thanks for that.I want to update a listbox where you had a combobox thats the only change.








  • BacktestingSystem.xlsm
    (328.8 KB, 20 views)
    Download














  • Reply Support Opposition

    Props Report

    20

    Topics

    89

    Posts

    236

    Integral

    Conqueror

    Rank: 3Rank: 3

    Integral
    236
     Author| Post on 2-11-2017 23:29:53 | All posts





    Kasan thank you for your reply sure.......this is a solution you did for someone. So credit for this code is to you thanks for that.I want to update a listbox where you had a combobox thats the only change.








  • BacktestingSystem.xlsm
    (328.8 KB, 22 views)
    Download














  • Reply Support Opposition

    Props Report

    20

    Topics

    89

    Posts

    236

    Integral

    Conqueror

    Rank: 3Rank: 3

    Integral
    236
     Author| Post on 2-12-2017 03:31:50 | All posts





    Kasan thank you for your reply sure.......this is a solution you did for someone. So credit for this code is to you thanks for that.I want to update a listbox where you had a combobox thats the only change.








  • BacktestingSystem.xlsm
    (328.8 KB, 24 views)
    Download














  • Reply Support Opposition

    Props Report

    12
    Return Post new threads

    Points policy of this forum

    Archiver|Mobile|Small dark house|Contact us|Excel Bar

    GMT-5, 9-25-2017 15:38 , Processed in 5.466301 second(s), 17 queries .

    Powered by Discuz! X3

    © 2001-2013 Comsenz Inc.

    !fastreply! Top !return_list!