Reputation: 11
I have set range from cell "U7" to "HV7". Purpose of this range is to count values in it.
Current code is working, but I would like to escape possibility of values beyond HV column, by selecting to last value.
Dim countRange As Range
Set countRange = Range("U7:HV7")
Dim rowcount As Long
rowcount = Application.WorksheetFunction.CountA(countRange)
Upvotes: 0
Views: 547
Reputation: 11
@SuperSymmetry provided me with desired solution.
Set countRange = Range("U7", Cells(7, Columns.Count).End(xlToLeft)
Values in my table are proper formatted so I could with this solution select all from cell U7 to the last value on the right.
Upvotes: 1