vba 在VBA中获取右侧单元格的值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26008268/
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
Get the value of the cell to the right in VBA
提问by Dan Dascalescu
What is the simplest code to get the value of the cell to the right of the current one?
获取当前单元格右侧单元格值的最简单代码是什么?
Selection.Worksheet.Cells(Selection.Row, Selection.Column + 1).Value
is a bit verbose.
Selection.Worksheet.Cells(Selection.Row, Selection.Column + 1).Value
有点冗长。
回答by Dan Dascalescu
The shortest code seems to be:
最短的代码似乎是:
ActiveCell.Offset(, 1).Value
Reference: ActiveCell, Offset. Both parameters to Offset
are optional, and the RowOffset
is omitted.
参考:ActiveCell,Offset。to 的两个参数Offset
都是可选的,RowOffset
省略了。