I have a question,
I have a table with data:
A B C
Type Height Length
1 2 2
2 3 9
3 8 2
2 3
1 0
1
I've been reading how to select that range but the problem I can't solve is how to select the range above until the row where at least one column contains a numeric value
. But the problem is that the range is a part of a reference
and Excel assumes that the number of used rows is larger because a lot of rows are blank and are part of a reference.
So my question is:
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
.
I tried
Sub Choose()
Dim Lastrow As Integer
Lastrow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
MsgBox Lastrow
'Range("A2:C" & Lastrow).Select
End Sub
But the MsgBox returns 118, which is because the Range I want to select is part of a reference...
Does anyone have an idea?
EDIT: That does not work, still select empty cells because it is reference...
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
If you have "ragged" columns like:
and want a range to get "all the data", then:
will select A1:C7