我有PHP和.Net的背景,但我是VBA的新手。是否可以在userform中从列表框中添加excel中的特定列单元格?谢谢。
我已经设法插入来自userform的新列。这是我的代码。
Private Sub btnSaveParameters_Click()
Dim totalParameters As Integer
totalParameters = ListBox1.ListCount
Dim lColumn As Long
Dim addlColumn As Long
Dim ws As Worksheet
Set ws = Worksheets("Reference")
Dim i As Integer
i = 0
Do Until i >= Me.ListBox1.ListCount
MsgBox "The vaue of i is: " & ListBox1.List(i)
lColumn = ws.Cells(3, ws.Columns.Count).End(xlToLeft).Column
addlColumn = lColumn + 1
ws.Cells(3, addlColumn).Value = Me.ListBox1.List(i)
i = i + 1
Loop
End Sub