Don\'t know what I\'m missing, but the examples I see posted do not appear to work.
I import data from a web query. I set the query to clear unused cells when it re
This may or may not suit your data needs, but if your data is all in one contiguous block, you can use CurrentRegion instead of UsedRange, like this:
With Cells(1, 1).CurrentRegion
MsgBox "I have " & .Rows.Count & " rows and " & .Columns.Count & " columns of data."
End With
Of course, if the region you care about does not start at cell A1, or if your sheet contains multiple contiguous regions that you care about, this option will not work. Depending on how predictable your data is, you can usually find at least one cell in each block of data, and once you have that, CurrentRegion will give you the range of the entire block.