Paste values from listbox below ActiveCell

Forestq

Active Member
Joined
May 9, 2010
Messages
482
hi,

I have listbox. When user select item and click add, the value should be add to sheet: one row below where the current field is selected.

Code:
     'Set addme = 'missing code
        
    For x = 0 To Me.lbsourceList.ListCount - 1
        If Me.lbsourceList.Selected(x) Then
        
            addme = Me.lbsourceList.List(x)
            
            addme.Offset(0, 1) = Me.lbsourceList.List(x, 1)
            addme.Offset(0, 2) = Me.lbsourceList.List(x, 2)
            addme.Offset(0, 3) = Me.lbsourceList.List(x, 3)
            addme.Offset(0, 4) = Me.lbsourceList.List(x, 4)
            addme.Offset(0, 5) = Me.lbsourceList.List(x, 5)
        
            Set addme = addme.Offset(1, 0)
            
        End If
    Next x
    For y = 0 To Me.lbsourceList.ListCount - 1
        If Me.lbsourceList.Selected(y) Then Me.lbsourceList.Selected(y) = False
    Next y


How can I do it?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,214,656
Messages
6,120,762
Members
448,991
Latest member
Hanakoro

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