在范围内选择单元格,直到行为空 [英] Select Cells in Range until row is blank

查看:56
本文介绍了在范围内选择单元格,直到行为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个电子表格,该电子表格始终从A列到I列,但是行数的范围可以变化.我想选择范围(A1:I20000)内的所有单元格,直到A列中的第一个空白单元格,因此,如果数据在202处结束,它将停止选择第202行的行.

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.

我尝试编写自己的公式,但不幸的是,B,C,E和H列继续选择到20000行

I tried writing my own formula but unfortunately columns B, C, E, and H continued to select down to row 20000

推荐答案

尝试一下:

Sub hfjksaf()
    Dim N As Long
    N = Cells(1, 1).End(xlDown).Row
    Range("A1:I" & N).Select
End Sub

例如:

这篇关于在范围内选择单元格,直到行为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆