|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test1()
- Application.ScreenUpdating = False
- Dim arr, i&, j&
- If Cells(65536, 6).End(3).Row = 2 Then
- Exit Sub
- End If
- arr = Range(Cells(3, 1), Cells(65536, 6).End(3))
- ReDim brr(1 To UBound(arr), 1 To 3)
- For i = 1 To UBound(brr)
- brr(i, 1) = Cells(1, 2)
- brr(i, 2) = Cells(1, 3)
- brr(i, 3) = Cells(1, 4)
- Next
- Range(Cells(3, 1), Cells(65536, 6).End(3)).ClearContents
- With Worksheets(2)
- .Cells(.Cells(65536, 1).End(3).Row + 1, 1).Resize(UBound(brr), UBound(brr, 2)) = brr
- .Cells(.Cells(65536, 4).End(3).Row + 1, 4).Resize(UBound(arr), UBound(arr, 2)) = arr
- .Cells(1, 1).CurrentRegion.Borders.LineStyle = xlContinuous
- End With
- Application.ScreenUpdating = True
- End Sub
- Sub test2()
- Application.ScreenUpdating = False
- Dim arr, brr, i&, j&
- With Worksheets(2)
- For i = 1 To .Cells(65536, 1).End(3).Row
- If .Cells(i, 1) = Cells(1, 10) And .Cells(i, 2) = Cells(1, 11) And .Cells(i, 3) = Cells(1, 12) Then
- .Range(.Cells(i, 4), .Cells(i, 9)).Copy Cells(Cells(65536, 9).End(3).Row + 1, 9)
- .Rows(i).Delete
- i = i - 1
- End If
- Next
- End With
- Application.ScreenUpdating = False
- End Sub
- Sub test3()
- Application.ScreenUpdating = False
- Dim arr, i&, j&
- If Cells(65536, 9).End(3).Row = 2 Then
- Exit Sub
- End If
- arr = Range(Cells(3, 9), Cells(65536, 14).End(3))
- ReDim brr(1 To UBound(arr), 1 To 3)
- For i = 1 To UBound(brr)
- brr(i, 1) = Cells(1, 10)
- brr(i, 2) = Cells(1, 11)
- brr(i, 3) = Cells(1, 12)
- Next
- Range(Cells(3, 9), Cells(65536, 14).End(3)).ClearContents
- With Worksheets(2)
- .Cells(.Cells(65536, 1).End(3).Row + 1, 1).Resize(UBound(brr), UBound(brr, 2)) = brr
- .Cells(.Cells(65536, 4).End(3).Row + 1, 4).Resize(UBound(arr), UBound(arr, 2)) = arr
- .Cells(1, 1).CurrentRegion.Borders.LineStyle = xlContinuous
- End With
- Application.ScreenUpdating = True
- End Sub
复制代码 来了来了 ... |
评分
-
1
查看全部评分
-
|