|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
latte2011 发表于 2012-4-23 17:44
还是有一个问题,和之前你分享的文件一样。就是enter listbox里面空行,就会出现错误。这个问题有没有办法 ...
这容易,只是没想到会有这样操作的- Private Sub ListBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
- Dim f%
- If KeyCode = 13 Then
- ActiveWorkbook.ActiveSheet.Unprotect "123"
- If ListBox1.ListIndex <> -1 Then
- f = Me.ListBox1.List(Me.ListBox1.ListIndex, 2)
- If f <> 0 Then
- ActiveCell(1, 1).Value = Arry(f, 1)
- ActiveCell(1, 2).Value = Arry(f, 2)
- ActiveCell(1, 3).Value = Arry(f, 3)
- ActiveCell(1, 4).Value = Arry(f, 4)
- ActiveCell(1, 5).Value = Arry(f, 5)
- ActiveCell(1, 6).Value = Arry(f, 6)
- Me.ListBox1.Clear
- Me.TextBox1 = ""
- Me.ListBox1.Visible = False
- Me.TextBox1.Visible = False
- KeyCode = 0
- ActiveCell.Offset(1, 0).Select
- End If
- End If
- ActiveWorkbook.ActiveSheet.Protect "123"
- End If
- If KeyCode = 27 Then
- TextBox1.Visible = False
- ListBox1.Visible = False
- End If
- End Sub
复制代码 !
|
|