office交流網(wǎng)--QQ交流群號(hào)及微信交流群

Access培訓(xùn)群:792054000         Excel免費(fèi)交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

微信交流群(請用微信掃碼)

        

VBA在列錶框ListBox指定行插入數(shù)據(jù)項(xiàng)目

2019-07-07 11:47:00
zstmtony
原創(chuàng)
10389

VBA在列錶框ListBox指定行插入數(shù)據(jù)項(xiàng)目

Listbox的additm 第2箇蔘數(shù) 可指定插入的位置

Option Explicit
Dim A As String
Dim B As Integer
Dim C As Integer
Dim I As Integer


Private Sub CMDADD_Click()
B = InputBox("想添加到第幾行?")
C = List1.ListCount
If B < 0 Or B > C + 1 Then
InputBox ("請不要超過現(xiàn)有行數(shù),請重新輸入")
Else
If Text1.Text = "" Then
MsgBox ("請?jiān)谖谋究蛑休斎雰?nèi)容")
Else
For I = C To B Step -1
List1.List(I) = List1.List(I - 1)
Next I
List1.AddItem Text1.Text, (B - 1)
End If
End If

End Sub

分享
文章分類
聯(lián)繫我們
聯(lián)繫人: 王先生
Email: 18449932@qq.com
QQ: 18449932
微博: officecn01
移動(dòng)訪問