vba 选择范围内的单元格直到行为空
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28306140/
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
Select Cells in Range until row is blank
提问by mmariano
I have a spread sheet that will always be from Columns A to I but the range of the amount of rows can vary. I want to Select all cells in range (A1:I20000) until the first blank cell in column A, so if the data ends at 202 it will stop selecting the rows at line 202.
我有一个电子表格,它总是从 A 列到 I 列,但行数的范围可能会有所不同。我想选择范围 (A1:I20000) 中的所有单元格,直到 A 列中的第一个空白单元格,因此如果数据在 202 处结束,它将停止选择第 202 行的行。
I tried writing my own formula but unfortunately columns B, C, E, and H continued to select down to row 20000
我尝试编写自己的公式,但不幸的是 B、C、E 和 H 列继续选择到第 20000 行
回答by Gary's Student
Try this:
尝试这个:
Sub hfjksaf()
Dim N As Long
N = Cells(1, 1).End(xlDown).Row
Range("A1:I" & N).Select
End Sub
For example:
例如:



