我有一个问题,
我有一张数据表:
A B C
Type Height Length
1 2 2
2 3 9
3 8 2
2 3
1 0
1
我一直在阅读如何选择该范围,但我无法解决的问题是如何选择until the row where at least one column contains a numeric value
以上的范围。但问题是范围是a part of a reference
,Excel假定使用的行数较大,因为很多行都是空白的并且是引用的一部分。
所以我的问题是:
How do I select the above range until the first row where none of columns A, B or C contain at least one numeric entry, and where the number of used rows is larger because the range is a part of reference
。
我试过
Sub Choose()
Dim Lastrow As Integer
Lastrow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
MsgBox Lastrow
'Range("A2:C" & Lastrow).Select
End Sub
但是MsgBox返回118,这是因为我想要选择的范围是引用的一部分......
有没有人有想法?
编辑: 这不起作用,仍然选择空单元格,因为它是引用...
Sub Sort3()
Dim oneRange As Range
Dim aCell As Range
Worksheets("Analys").Select
Set oneRange = ActiveCell.CurrentRegion.Range("D1")
Set aCell = Range("M10")
oneRange.Sort Key1:=aCell, Order1:=xlDescending, Header:=xlYes
End Sub
答案 0 :(得分:1)
如果您有“不规则”列,例如:
并希望范围获得“所有数据”,然后:
Sub GetTheBlock()
Range("A1").CurrentRegion.Select
End Sub
将选择 A1:C7