|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 复制列()
- Dim Arr, Brr(), drow%, i%, wb As Workbook, sht As Worksheet
- Set wb = GetObject(Worksheets("原始表路径").Range("b1") & "\原始表.xlsx")
- Set sht = wb.Worksheets("原始表")
- Arr = sht.Range("a1").CurrentRegion
- With Worksheets("复制表")
- ReDim Brr(1 To UBound(Arr), 1 To 3)
- For i = 2 To UBound(Arr)
- Brr(i - 1, 1) = Arr(i, 3): Brr(i - 1, 2) = Arr(i, 1): Brr(i - 1, 3) = Arr(i, 4)
- Next
- .Range("a2:c65536").ClearContents
- .Range("a2").Resize(UBound(Arr) - 1, 3) = Brr
- End With
- End Sub
复制代码 |
|