hello i search a lot of information in internet but i can not get it work .I tray to add the search results from listbox in a sheet number the sheet name is (Tabelle1 ) listbox name is (lsbWarenausgang) and the CommandButton name is (CommandButton3)
Asked
Active
Viewed 509 times
-1
-
1please share your code attmepts – Shai Rado Aug 04 '16 at 08:24
1 Answers
1
Assuming you want pass the value to the cell C1:
Private Sub CommandButton3_Click()
Worksheets("Tabelle1").Range("C1").Value = lsbWarenausgang.Value
End Sub
For multi-columns ListBox:
Private Sub CommandButton3_Click()
Dim i As Integer
Dim k As Integer
With Me.lsbWarenausgang
For k = 0 To .ListCount - 1
If .Selected(k) = True Then
For i = 1 To 5
Worksheets("Tabelle1").Cells(i, 1) = Me.lsbWarenausgang.List(k, i - 1)
Next i
End If
Next k
End With
End Sub

Trimax
- 2,413
- 7
- 35
- 59
-
-
With multi-columns you must to iterate de List checking the `.Selected ` property and if True get the .List(nRow, nCol) element. – Trimax Aug 04 '16 at 09:03
-
@d00nn12345 It's an etiquette norm in StackOverflow to clicking in the **checking simbol** if the answer solves your problem. – Trimax Aug 04 '16 at 09:15
-
thx a lot juyt i was checking it if it work what I need to change to a horizontal load. because the data load everything into vertical – d00nn12345 Aug 04 '16 at 09:19