|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Option Explicit
Sub test()
Dim ar, i&, strFileName$, strPath$, m&, n&, vTemp
strPath = ThisWorkbook.Path & "\"
strFileName = strPath & "原始数据.xls"
If Dir(strFileName) = "" Then MsgBox "原始数据不存在,请检查!": Exit Sub
Application.ScreenUpdating = False
With GetObject(strFileName)
ar = .Worksheets(1).[A2].CurrentRegion.Value
m = UBound(ar): n = m \ 2
For i = 1 To UBound(ar)
vTemp = ar(i, 1): ar(i, 1) = ar(m - i + 1, 1): ar(m - i + 1, 1) = vTemp
Next i
.Close False
End With
n = Cells(2, Columns.Count).End(xlToLeft).Column + 1
m = IIf(m > 15, 15, m)
Cells(2, n).Resize(m) = ar
Application.ScreenUpdating = True
Beep
End Sub
|
评分
-
1
查看全部评分
-
|