命令按钮从列表框添加到 sheet

CommandButton to add from listbox to sheet

你好,我在互联网上搜索了很多信息,但我无法使用它。我希望将列表框中的搜索结果添加到 sheet 编号中,sheet 名称是 (Tabelle1)列表框名称为 (lsbWarenausgang),命令按钮名称为 (CommandButton3)

假设您要将值传递给单元格 C1:

Private Sub CommandButton3_Click()

    Worksheets("Tabelle1").Range("C1").Value = lsbWarenausgang.Value

End Sub

对于多列列表框:

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