vba 如何将单元格范围向右移动
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11837071/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 17:11:50 来源:igfitidea点击:
How to shift a range of cells to the right
提问by user1452091
Can someone please help me in shifting a defined cell range one column to the right. if i define
有人可以帮我将定义的单元格范围向右移动一列吗?如果我定义
rng = B2:B3
I need a code to move my values in B2:B3 to B3:B4.
我需要一个代码来将 B2:B3 中的值移动到 B3:B4。
Here is what i have so far and none of this works. I get an error in the third line.
这是我到目前为止所拥有的,但这些都不起作用。我在第三行出现错误。
Dim rng As Range
Set rng = Range(DataSheet.Cells(arr(z)(1), 2), DataSheet.Cells(arr(z)(1), LastCol))
rng.Insert Shift:=xlShiftToRight '(i tried this first)
or
rng.Offset(0, 1).Select '(I tried this second and this also did not work)
回答by Tim Williams
rng.Cut rng.Cells(1).Offset(0,1) 'assuming you really mean to move right