Finding the Last Row in Excel using Excel VBA



In excel there are situations where we need to find last row of an sheet. This can achieved by defining a variable and assigning the last row value to the variable and using offset property to find the last row.

Method 1: Declaring the variable and assigning the last row to the variable.
Eg:
Dim FinRow   'Finrow is variable which hold the value of last row.
Finrow=Range("A65536").End(x1Up).Row
Now Finrow variable contains the last row number in Column "A"

Now if you want to put total in the last row of Column "A" then use
Range("A"&Finrow+1).Value="Total"

0 comments: