|
Option Explicit
Sub TEST6()
Dim ar, i&, j&, r&
If [J1].Value = 0 Or [J2].Value = 0 Then MsgBox "数据为空": Exit Sub
Application.ScreenUpdating = False
ar = Sheets(1).UsedRange
r = 1
For i = 2 To UBound(ar)
If ar(i, 1) = [J1].Value And ar(i, 2) = [J2].Value Then
r = r + 1
For j = 1 To UBound(ar, 2)
ar(r, j) = ar(i, j)
Next j
End If
Next i
Columns("A:H").Clear
If r > 1 Then
With [A2].Resize(r, UBound(ar, 2))
.Value = ar
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Borders.LineStyle = xlContinuous
End With
Else
MsgBox "没有符合条件的数据!"
End If
Application.ScreenUpdating = True
Beep
End Sub
|
评分
-
1
查看全部评分
-
|