参与一下。。。- Sub ykcbf() '//2024.1.22
- r = Me.Cells(Rows.Count, "y").End(3).Row
- arr = Me.Range("y3:ao" & r)
- ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2) - 2)
- ReDim crr(1 To UBound(arr), 1 To UBound(arr, 2) - 2)
- For i = 1 To UBound(arr)
- If arr(i, 1) = "改制职工" Then
- st = CStr(arr(i, 2))
- If InStr(st, "厨房") = 0 Then
- m = m + 1
- For j = 3 To UBound(arr, 2)
- brr(m, j - 2) = arr(i, j)
- Next
- Else
- n = n + 1
- For j = 3 To UBound(arr, 2)
- crr(n, j - 2) = arr(i, j)
- Next
- End If
- End If
- Next
- Me.[au3:bi10000] = ""
- Me.[bo3:cc10000] = ""
- Me.[au3].Resize(m, UBound(brr, 2)) = brr
- Me.[bo3].Resize(n, UBound(crr, 2)) = brr
- MsgBox "OK!"
- End Sub
复制代码
|