|
- Sub 查询系统()
- Dim r%, i%
- Dim arr, brr
- With Worksheets("sheet1")
- xm = .Range("n1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("b2:i" & r)
- ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
- For i = 1 To UBound(arr)
- For j = 4 To UBound(arr, 2)
- If arr(i, j) = xm Then
- Exit For
- End If
- Next
- If j <= UBound(arr, 2) Then
- m = m + 1
- For k = 1 To UBound(arr, 2)
- brr(m, k) = arr(i, k)
- Next
- End If
- Next
- For i = 1 To m
- For j = 4 To UBound(brr, 2)
- If brr(i, j) <> xm Then
- brr(i, j) = ""
- End If
- Next
- Next
- .Range("k3:r" & .Rows.Count).Clear
- .Columns(11).NumberFormatLocal = "m月d日"
- With .Range("k3").Resize(m, UBound(brr, 2))
- .Value = brr
- .Borders.LineStyle = xlContinuous
- .HorizontalAlignment = xlCenter
- .VerticalAlignment = xlCenter
- End With
- End With
- End Sub
复制代码 |
|