[英]Selection of range in both column and row direction in Excel VBA
I want to select the data from E1 to untill the cell that contains data in Column H. is it possible through VBA?. 我想从E1中选择数据,直到在H列中包含数据的单元格。是否可以通过VBA?
I have tried with this code: 我已经尝试使用此代码:
Range(Range("e1").End(xlDown), Range("h1").End(xlDown)).Select
But it selects E2 to H2. 但是它选择E2到H2。
Use: 采用:
Range("E1:H" & Range("H" & Rows.Count).End(xlUp).Row)
This will select the range from E1 to last populated cell of column H 这将选择从E1到H列的最后一个填充单元格的范围
I want to select the data from E1 to untill the cell that contains data in Column H
我想从E1选择数据,直到包含H列中数据的单元格
Will this work for you? 这对您有用吗?
Range("e1", Columns("h").Find("*")).Select
Corresponds exactly to what you said if H1
is always empty. 如果
H1
始终为空,则与您所说的完全一致。
Unless you meant the last cell that contains data in Column H ? 除非您的意思是最后一个包含H列数据的单元格 ? In that case:
在这种情况下:
Range("e1", Range("h999999").End(xlUp)).Select
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.