|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
With ListBox1
r = ActiveCell.Row - 1
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
Cells(r, 7) = .List(i, 0)
Cells(r, 8) = .List(i, 1)
Exit For
End If
Next i
.Visible = False
End With
End Sub
Private Sub Worksheet_Change(ByVal T As Range)
If T.Row > 1 And T.Column = 5 Then
If T.Count > 1 Then End
If T.Value = "" Then End
With Sheets("目录")
r = .Cells(Rows.Count, 1).End(xlUp).Row
If r < 2 Then MsgBox "目录为空!": End
ar = .Range("a1:g" & r)
End With
Dim br()
ReDim br(1 To UBound(ar), 1 To 2)
For i = 2 To UBound(ar)
If ar(i, 1) = T.Value Then
n = n + 1
br(n, 1) = ar(i, 4)
br(n, 2) = ar(i, 3)
T.Offset(, 1) = ar(i, 2)
End If
Next i
With ListBox1
.Visible = True
.Top = T.Top + 15
.Left = T.Left
.Clear
.List = br
End With
Else
ListBox1.Visible = False
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal T As Range)
If T.Column <> 5 Then
ListBox1.Clear
ListBox1.Visible = False
End If
End Sub
|
评分
-
1
查看全部评分
-
|