ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need simple macro to copy and paste values (https://www.excelbanter.com/excel-programming/425498-need-simple-macro-copy-paste-values.html)

Bern Notice[_2_]

Need simple macro to copy and paste values
 
I need to write a macro to copy 2 total cells from the bottom of one sheet
and paste those values into cells on another sheet. The total cells on
"sheet 1" are in Columns C and D and are one row below the last data in
columns A & B. Also, there will be a varying number of rows on "sheet 1" at
different times.

The cells on "sheet 2" that I need to paste the values in are D2 and E2.

This is actually going to be an addition to a current macro that I have
started, but I can't get this simple task to work. :(

JLGWhiz[_2_]

Need simple macro to copy and paste values
 
This assumes that there is no data in columns A & B below
the Total line.

Sub sl()
Dim lr As Long
lr = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
Range("A" & lr & ":B" & lr).Copy Sheets("Sheet2").Range("D2")
End Sub


"Bern Notice" wrote in message
...
I need to write a macro to copy 2 total cells from the bottom of one sheet
and paste those values into cells on another sheet. The total cells on
"sheet 1" are in Columns C and D and are one row below the last data in
columns A & B. Also, there will be a varying number of rows on "sheet 1"
at
different times.

The cells on "sheet 2" that I need to paste the values in are D2 and E2.

This is actually going to be an addition to a current macro that I have
started, but I can't get this simple task to work. :(





All times are GMT +1. The time now is 11:09 AM.

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