我试图将列表框中的项目拆分,以便我只显示第一个换行符,但是看起来下标超出了范围,我无法确定错误。
Private Sub DisplayTasksInListView()
Dim i As Integer
Dim taskList As Variant
Dim taskItem As Variant
With ListBoxTask
ListBoxTask.Clear
taskList = ActiveSheet.Range("B3:B5")
For Each taskItem In taskList
ListBoxTask.AddItem Split(taskItem, Chr(10))(0)
Next taskItem
End With
End Sub