需要列表框值单击后单元格中显示
我有一个带有多个迭代的表单控件列表框。 我希望电子表格中的某个单元格显示用户select的列表框项目的内容,并在用户进行不同的select时进行更改。
不知道从哪里开始。
我猜你已经知道如何写入单元格了:
Set TxtRng = ActiveWorkbook.Sheets("YourSheet").Range("A1") TxtRng.Value = "Your Text Here"
而下面的一段代码将进入ListBoxChanged-Event ,所以每次在列表框中select一个新值时,单元格将显示新的值。
For i = 0 To ListBox1.ListCount - 1 If ListBox1.Selected(i) Then SelectedItemText = ListBox1.List(i) End If Next i 'Set the value of the cell to the selected item. TxtRng.Value = SelectedItemText
希望这可以帮助。