|
板主的VBA太强大了,一定要好好向您学习,板主,您好!我是新人,有个问题请教您。 我做了个新品管理。本来是想点击userform1里面Listview时,Userform2里面自动显示对应栏数据, 但是出现报错了,可能帮我确认一下吗? 谢谢您!期待您的指正。Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
Dim r&, c%
If ListView1.ListItems.Count = 0 Then Exit Sub
r = Val(Item.SubItems(5))
If ComboBox9.ListIndex = 0 Then
c = 14
ElseIf ComboBox9.ListIndex = 1 Then
c = 26
Else
c = 38
End If
TextBox1 = arr(r - 5, 2)
TextBox2 = arr(r - 5, 4)
DTPicker2 = arr(r - 5, 5)
TextBox7 = arr(r - 5, 6)
TextBox3 = arr(r - 5, 7)
TextBox4 = arr(r - 5, 8)
TextBox6 = arr(r - 5, 9)
ComboBox2 = arr(r - 5, 10)
ComboBox4 = arr(r - 5, 11)
ComboBox3 = arr(r - 5, 12)
ComboBox5 = arr(r - 5, 13)
TextBox12 = arr(r - 5, c + 4)
TextBox13 = arr(r - 5, c + 5)
TextBox5 = arr(r - 5, c + 6)
TextBox8 = arr(r - 5, c + 8)
TextBox10 = arr(r - 5, 24)
TextBox17 = arr(r - 5, 25)
TextBox22 = arr(r - 5, 36)
TextBox23 = arr(r - 5, 37)
TextBox24 = arr(r - 5, 48)
TextBox25 = arr(r - 5, 49)
ComboBox1 = arr(r - 5, 3)
TextBox18 = arr(r - 5, c + 0)
TextBox19 = arr(r - 5, c + 1)
TextBox20 = arr(r - 5, c + 2)
TextBox21 = arr(r - 5, c + 3)
TextBox15 = arr(r - 5, c + 7)
TextBox16 = arr(r - 5, c + 9)
Dim i%
For i = 1 To 33
UserForm2.Controls("ComboBox" & i) = arr(r - 5, 14 + 3 * i - 2 + 35)
UserForm2.Controls("TextBox" & i) = arr(r - 5, 14 + 3 * i - 1 + 35)
Next
For n = 34 To 66
UserForm2.Controls("ComboBox" & n) = arr(r - 5, 14 + 3 * i + 35)
Next
End Sub
|
|