|
查询按钮:
Private Sub CommandButton6_Click()
On Error Resume Next
With Sheets("收支流水账")
If .Range("C" & Rows.Count).End(xlUp).Row < 15 Then Exit Sub
y = Application.InputBox("请输入要查询的单据号:", "提示")
If y = "" Then Exit Sub
ListBox1.Clear
Application.ScreenUpdating = False
Dim x As Range
For Each x In .Range("C15:C" & .Range("C" & Rows.Count).End(xlUp).Row)
If x.Value = y And y <> "" Then
Me.Height = 470
ListBox1.AddItem x.Offset(0, -2) & " " & x.Offset(0, -1) & " " & x.Offset(0, 1) & " " & x.Offset(0, 2) & " " & x.Offset(0, 3) & " " & x.Offset(0, 4)
End If
Next
Set x = Nothing
Application.ScreenUpdating = True
End With
End Sub |
|