I've this excel file with normal data. I want to know if there's is a way to know how many rows contains values using a macro with VB code.
Asked
Active
Viewed 48 times
-1
-
4this post may be interesting for you: http://stackoverflow.com/questions/11169445/error-finding-last-used-cell-in-vba/11169920#11169920 – Dmitry Pavliv Feb 21 '14 at 14:39
-
Do you wish to exclude any rows in the middle that do not contain data?? – Gary's Student Feb 21 '14 at 14:50
-
@Gary'sStudent no Gary I just want to know the size. I mean until which row that data is being populated – Guillermo Oramas R. Feb 21 '14 at 14:56
-
@pnuts just the last occupied row – Guillermo Oramas R. Feb 21 '14 at 14:56
1 Answers
1
Based on your Comment:
Sub qwerty()
Dim r As Range
Dim nLastRow As Long
ActiveSheet.UsedRange
Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.Count + r.Row - 1
MsgBox nLastRow
End Sub

Gary's Student
- 95,722
- 10
- 59
- 99