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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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