ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cleaning up code (https://www.excelbanter.com/excel-programming/430177-re-cleaning-up-code.html)

Jacob Skaria

Cleaning up code
 

The below code will copy all cells from Sheet1 to Sheet2.

Sheets("Sheet1").Cells.Copy Sheets("Sheet2").Range("A1")

PS: To copy all cells you can also try sheet copy...

If this post helps click Yes
---------------
Jacob Skaria


"kevin" wrote:

Hi I recorded a copy/paste special as values macro but am sure there is a
more elegant way of writing the code. what part of the code below is not
necessary?

Sheets("Market").Select
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select

Thanks
Kevin



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

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