|
Sub qs() '2024/7/2
Dim arr, i, j, brr, xwb As Workbook
With Sheet1
arr = .Range("a1:j" & .Cells(Rows.Count, 1).End(3).Row)
ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
For i = 1 To UBound(arr)
If InStr(arr(i, 9), "已通知") Then
If InStr(arr(i, 10), "未迁出") Or arr(i, 10) = Empty Then
m = m + 1
For j = 1 To UBound(arr, 2)
brr(m, j) = arr(i, j)
brr(m, 5) = "'" & arr(i, 5)
Next
End If
End If
Next
End With
Set xwb = Workbooks.Add
xwb.Sheets(1).Range("a1").Resize(1, UBound(arr, 2)) = Application.Index(arr, 1, 0)
xwb.Sheets(1).Range("a2").Resize(m, UBound(arr, 2)) = brr
With xwb.Sheets(1).Range("a1").Resize(m + 1, UBound(brr, 2))
.Borders.LineStyle = 1
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.EntireColumn.AutoFit
End With
End Sub
|
|