ExcelBanter

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

Kevin

Cleaning up code
 

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

Jacob Skaria

Cleaning up code
 

I missed the paste special..Try the below

Sub Macro2()
Sheets("Market").UsedRange = Sheets("Market").UsedRange.Value
End Sub

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


Norie

Cleaning up code
 
Using PasteSpecial.

With Sheets("Market")
.Cells.Copy
.Range("A1").PasteSpecial xlPasteValues
End With

On Jun 22, 6:22*pm, 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 04:10 PM.

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