|
Dim arr '2024/0519
Private Sub CommandButton2_Click() '全部按钮
全部数据
End Sub
Private Sub CommandButton5_Click() '查找按钮
Dim i, s, t
t = Me.TextBox1.Value
Me.ListBox1.Clear
For i = 2 To UBound(arr)
s = arr(i, 2) & arr(i, 4) & arr(i, 5) & arr(i, 6) & arr(i, 7) & arr(i, 9) & arr(i, 10)
If s Like "*" & t & "*" Then
Me.ListBox1.AddItem arr(i, 2)
Me.ListBox1.List(ListBox1.ListCount - 1, 1) = arr(i, 4)
Me.ListBox1.List(ListBox1.ListCount - 1, 2) = arr(i, 5)
Me.ListBox1.List(ListBox1.ListCount - 1, 3) = arr(i, 6)
Me.ListBox1.List(ListBox1.ListCount - 1, 4) = arr(i, 7)
Me.ListBox1.List(ListBox1.ListCount - 1, 5) = arr(i, 9)
Me.ListBox1.List(ListBox1.ListCount - 1, 6) = arr(i, 10)
End If
Next
End Sub
Private Sub CommandButton6_Click() '退出按钮
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim i
Me.ListBox1.ColumnCount = 7
arr = Sheet2.Range("a1").CurrentRegion.Value
全部数据
End Sub
Sub 全部数据()
Application.ScreenUpdating = False
Me.ListBox1.Clear
For i = 2 To UBound(arr)
Me.ListBox1.AddItem arr(i, 2)
Me.ListBox1.List(ListBox1.ListCount - 1, 1) = arr(i, 4)
Me.ListBox1.List(ListBox1.ListCount - 1, 2) = arr(i, 5)
Me.ListBox1.List(ListBox1.ListCount - 1, 3) = arr(i, 6)
Me.ListBox1.List(ListBox1.ListCount - 1, 4) = arr(i, 7)
Me.ListBox1.List(ListBox1.ListCount - 1, 5) = arr(i, 9)
Me.ListBox1.List(ListBox1.ListCount - 1, 6) = arr(i, 10)
Next
Application.ScreenUpdating = True
End Sub
|
|