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.
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.
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
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
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.