How to get the row number of bottom usedrange?

London12F

Board Regular
Joined
Jun 21, 2016
Messages
59
As new set of cells has to be copied at the bottom of existing used cells,
but the VBA code below is failed (far lower than my used range),

<colgroup><col></colgroup><tbody>
</tbody>
Code:
[TABLE="width: 546"]
<tbody>[TR]
  [TD="class: xl66, width: 546"]a =  ActiveCell.SpecialCells(xlLastCell).Row[/TD]
[/TR]
</tbody>[/TABLE]

please advise the code.

<tbody>
</tbody>
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
If you want the Lastrow with data in column "A"
Try this:
Code:
Sub Last_Row()
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
MsgBox Lastrow
End Sub

And be aware there are probable 20 other ways to do this also.
 
Upvote 0
Hi,

try

Code:
a =  Activesheet.cells.SpecialCells(xlLastCell).Row

if there a formats below the data, this code could have problems.

regards
 
Upvote 0
How about
Code:
Sub LstRw()

    Dim UsdRws As Long

    UsdRws = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row

End Sub
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,923
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top