Excel VBA 用于从特定单元格开始选择整列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13166510/
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
Excel VBA for selecting an entire column starting from a specific cell
提问by czchlong
How do I select the entire column after a specific cell?
如何在特定单元格后选择整列?
For example, I would like to select the entire column after C24
so that includes C24, C25, ...
例如,我想在之后选择整个列,C24
以便包括C24, C25, ...
I have worked with the following snippet with no success:
我使用了以下代码段但没有成功:
ActiveSheet.Range("C24", ActiveSheet.Range("C24").End(xlDown)).Select
Could someone please correct my error?
有人可以纠正我的错误吗?
回答by A. Webb
You just need to wrap the two references within a Range
:
您只需要将两个引用包装在 a 中Range
:
Range(ActiveSheet.Range("C24"), ActiveSheet.Range("C24").End(xlDown)).Select
回答by Doug Glancy
Here's an approach that will work even if there are cells with content below C24:
这是一种即使存在内容低于 C24 的单元格也能工作的方法:
With ActiveSheet
.Range(.Range("C24"), .Range("C" & .Rows.Count)).Select
End With
回答by Jeremiah
i don't know if you want a formula for it or if any method will work but if you select the cell you want it to start on and hold ctrl+shift+down arrow it will select that cell and everything below it.
我不知道你是否想要一个公式或者是否有任何方法可以工作但是如果你选择你想要它开始的单元格并按住 ctrl+shift+向下箭头它会选择那个单元格和它下面的所有内容。