Excel VBA last row with data in a column copy to another cell

EuginG

New Member
Joined
May 3, 2016
Messages
14
Office Version
  1. 2016
Platform
  1. Windows
Hi!
I have B column with hundreds or thousands rows (always different quantity). I need to copy last row (cell) with data (in the B column) and paste it, for example, to S15 cell.

Please help!
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Hi!
I have B column with hundreds or thousands rows (always different quantity). I need to copy last row (cell) with data (in the B column) and paste it, for example, to S15 cell.

Please help!
Hi Euging, welcome to the boards.

If I have understood correctly then this should do the trick:

Code:
Sub CopyLastRow()
' Defines variable
Dim LastRow As Long


' Defines LastRow as the last row of data based on column B
LastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).End
' Copies the row of column B to cell S15
Range("B" & LastRow).Copy Range("S15")


End Sub
 
Upvote 0
Try this Vba Script:
Code:
Sub Last_Row_Here()
Application.ScreenUpdating = False
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Range("B" & Lastrow).Copy Destination:=Range("S15")
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thanks, guys! Both answers WORK!!! I was so close… :)))

Fishboy! Your solution is just fine! But I suppose I need to use “Row” instead of “End” in the string you have posted:

LastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).End


Have a nice day!

;)
 
Upvote 0
Thanks, guys! Both answers WORK!!! I was so close… :)))

Fishboy! Your solution is just fine! But I suppose I need to use “Row” instead of “End” in the string you have posted:

LastRow = ActiveSheet.Cells(Rows.Count, "B").End(xlUp).End


Have a nice day!

;)
Ooops! Typo ;)

Yes it should read .Row and not .End
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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