这是一个奇怪的问题,我无法找到答案:
我想选择最后一行(可能使用Cells(Rows.Count, Column.Count).End(xlUp).Row
)并将其移至上一行的末尾。
我正在考虑使用与我的转置功能(复制/粘贴)类似的东西:
Dim r As Range, N As Long
N = Cells(Rows.Count, "A").End(xlUp).Row
Set r = Cells(N, Column.Count).EntireRow
r.Copy
Cells(N + 1, 1).PasteSpecial Transpose:=True
r.Delete
在
在
有人做了类似的事情并且愿意分享一些帮助/建议吗?
答案 0 :(得分:1)
这样可以解决问题:
Dim N As Long
N = Cells(Rows.Count, "A").End(xlUp).row
Range(Cells(N, 1), Cells(N, Columns.Count).End(xlToLeft)).Cut Cells(N - 1, Columns.Count).End(xlToLeft).Offset(0, 1)
以下是细分
N = Cells(Rows.Count, "A").End(xlUp).row
Cells(N, 1)
Cells(N, Columns.Count).End(xlToLeft)
Cells(N - 1, Columns.Count).End(xlToLeft).Offset(0, 1)
Range(Cells(N, 1), Cells(N, Columns.Count).End(xlToLeft)).Cut Destination:=Cells(N - 1, Columns.Count).End(xlToLeft).Offset(0, 1)