ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Advise (https://www.excelbanter.com/excel-programming/271648-vba-advise.html)

RB[_3_]

VBA Advise
 
Hi
I hope if someone can help show me a cleaner way of doing the following
things. I tried the recorder & it comes up with huge code

* Copy a Row e.g Row 5 from sheet 1 to sheet 2 at the end of last row
* Copy a formula from a row/cell to all the way to last row

Thanks in advance for your help



acw

VBA Advise
 
RB

One way.
Copy a row:
Assuming that you are in sheet1 then
Cells(5, 1).EntireRow.Copy Destination:=Sheets
("sheet2").Range("a65536").End(xlUp).Offset(1, 0)

Copy a formula:
Assuming that you are in the cell that you want copied and
that column A has an entry in the last cell that you want
the formula copied down to then:
ActiveCell.Copy Destination:=Range(Cells(ActiveCell.Row,
ActiveCell.Column), Cells(Range("a65536").End(xlUp).Row,
ActiveCell.Column))

Tony
-----Original Message-----
Hi
I hope if someone can help show me a cleaner way of doing

the following
things. I tried the recorder & it comes up with huge code

* Copy a Row e.g Row 5 from sheet 1 to sheet 2 at the end

of last row
* Copy a formula from a row/cell to all the way to last

row

Thanks in advance for your help


.



All times are GMT +1. The time now is 07:15 PM.

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