使用vba后
显示用户类型未定义 网上查了说没有引入相关project
这是代码,大lao看应该引那些project
Private Sub ListBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
If ListBox1.ListIndex = -1 Then Exit Sub
Dim i&, str$
With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
str = str & ";" & .List(i)
End If
Next
.TopLeftCell.Offset(, -1).Value = Mid(str, 2)
.Visible = False
End With
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Row > 2 And Target.Column = 2 Then
Dim arr
arr = Sheets("Sheet3").Cells(2, 1).Resize(Sheets("Sheet3").Cells(Rows.Count, 1).End(xlUp).Row - 1)
With ListBox1
.MultiSelect = 1
.ListStyle = 1
.List = arr
.Top = Target.Top
.Left = Target.Left + Target.Width
.Height = Target.Height * 15
.Width = 90
.Visible = True
End With
Else
ListBox1.Clear
ListBox1.Visible = False
End If
End Sub