|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub f2z() '反向-正向
- Dim r%, i%
- Dim arr, brr
- With Worksheets("反向")
- r = .UsedRange.Find(what:="*", LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByRows, searchdirection:=xlPrevious).Row
- c = .UsedRange.Find(what:="*", LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByColumns, searchdirection:=xlPrevious).Column
- arr = .Range("a1").Resize(r, c)
- End With
- ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
- brr(UBound(brr), 1) = arr(1, 1)
- For i = UBound(arr) - 1 To 3 Step -2
- For j = UBound(arr, 2) To 1 Step -1
- brr(UBound(arr) - i, UBound(arr, 2) - j + 1) = arr(i, j)
- brr(UBound(arr) - i + 1, UBound(arr, 2) - j + 1) = arr(i + 1, j)
- Next
- Next
- With Worksheets("正向")
- .Range("a1").Resize(UBound(brr), UBound(brr, 2)) = brr
- End With
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|