ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   finding the last row for a macro (https://www.excelbanter.com/excel-programming/387563-finding-last-row-macro.html)

Mctabish[_3_]

finding the last row for a macro
 
I want to copy an item from on cell in worksheet3 (CO2) and then paste it in
worksheet1 (CO2) then copy this all the way down to the last row. I would
like to do this in a macro. I have tried recording this several ways, but it
is not reliable.

Also, I would like to go to the bottom row, and fill lastrow,A through
lastrow,colCN with the value of lastrow,A

How would this macro look?

Thanks
Mc



joel

finding the last row for a macro
 
Sub copyrange()

Sheets("sheet1").Range("CO2") = Sheets("sheet3").Range("CO2")
Sheets("sheet1").Activate

Lastrow = Cells(Rows.Count, 1).End(xlUp).Row

Cells(Lastrow, 1).Copy Destination:=Range("B" & CStr(Lastrow) & ":CN" &
CStr(Lastrow))

End Sub

"Mctabish" wrote:

I want to copy an item from on cell in worksheet3 (CO2) and then paste it in
worksheet1 (CO2) then copy this all the way down to the last row. I would
like to do this in a macro. I have tried recording this several ways, but it
is not reliable.

Also, I would like to go to the bottom row, and fill lastrow,A through
lastrow,colCN with the value of lastrow,A

How would this macro look?

Thanks
Mc





All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com