當前位置:名人名言大全網 - 短信平臺 - VBA的ListBox賦值後,無法正常顯示賦值後的值

VBA的ListBox賦值後,無法正常顯示賦值後的值

郵件已收到,現修改如下,顯示速度與修改前沒有差別:

Private Sub CommandButton1_Click()

Dim lngCnt As Long, Wnd As Long

With ListBox1

.Visible = False

Wnd = .TopIndex

For lngCnt = 0 To .ListCount - 1

.ListIndex = lngCnt

.List(lngCnt, 0) = "+++"

Next

.TopIndex = Wnd

.Visible = True

End With

End Sub

Private Sub CommandButton2_Click()

Dim lngCnt As Long, Wnd As Long

With ListBox1

.Visible = False

Wnd = .TopIndex

For lngCnt = 0 To .ListCount - 1

.ListIndex = lngCnt

.List(lngCnt, 0) = lngCnt

Next

.TopIndex = Wnd

.Visible = True

End With

End Sub

Private Sub CommandButton3_Click()

If ListBox1.ListIndex <> -1 Then

MsgBox ListBox1.List(ListBox1.ListIndex, 0)

End If

End Sub

Private Sub UserForm_Initialize()

Dim lngCnt As Long

With ListBox1

.Clear

.ColumnCount = 2

.ColumnWidths = "45;100"

For lngCnt = 0 To 1000

.AddItem (lngCnt)

.List(lngCnt, 1) = "0000000000" & lngCnt

Next

End With

End Sub

如果還有問題,請把文件發到我的郵箱:

ljl2008610@63.com