How to get the row number of bottom usedrange?

London12F

Board Regular
Joined
Jun 21, 2016
Messages
59
[TABLE="width: 546"]
<colgroup><col></colgroup><tbody>[TR]
[TD]As new set of cells has to be copied at the bottom of existing used cells,[/TD]
[/TR]
[TR]
[TD]but the VBA code below is failed (far lower than my used range),[/TD]
[/TR]
</tbody>[/TABLE]
Code:
[TABLE="width: 546"]
<tbody>[TR]
  [TD="class: xl66, width: 546"]a =  ActiveCell.SpecialCells(xlLastCell).Row[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 546"]
<tbody>[TR]
[TD="class: xl66, width: 546"]please advise the code.[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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