|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
初学者, 下面是程序
listbox click 点击1次, 实际相应3次, 好奇怪
Dim aa As Integer
Dim gotf As Boolean
Private Sub CommandButton1_LostFocus()
gotf = 0
End Sub
Private Sub ListBox1_Click()
Dim iRow As Integer
Dim i As Byte
iRow = Worksheets("sheet3").Range("A65536").End(xlUp).Row + 1
aa = aa + 1
Debug.Print aa
Debug.Print "gotf = " & gotf
If gotf = True Then
For i = 1 To 3
Sheet3.Cells(iRow, i) = ListBox1.Column(i - 1)
Next
End If
End Sub
Private Sub ListBox1_gotfocus()
gotf = 1
Dim arr
arr = Sheet3.Range("a1:d7")
With ListBox1
.ColumnCount = 3
.List = arr
.BoundColumn = 0
.ColumnHeads = True
End With
Debug.Print "gotfocus"
End Sub
|
|