ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy / Paste Value (https://www.excelbanter.com/excel-programming/396965-copy-paste-value.html)

Richard

Copy / Paste Value
 
I was very happy when I found that I could simplify my code when copy and
pasting to one line as follows

Range("Current_Prices").Copy Destination:=Range

However I would like to paste the value. Is this possible in one line or do
we have to make do with

Application.Goto Reference:="Current_Prices"
Selection.Copy
Application.Goto Reference:="Previous_Prices"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

Thanks in advance for your assistance



I.R))

Copy / Paste Value
 
On 6 ruj, 13:00, Richard wrote:
I was very happy when I found that I could simplify my code when copy and
pasting to one line as follows

Range("Current_Prices").Copy Destination:=Range

However I would like to paste the value. Is this possible in one line or do
we have to make do with

Application.Goto Reference:="Current_Prices"
Selection.Copy
Application.Goto Reference:="Previous_Prices"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

Thanks in advance for your assistance


try with this "Worksheets("NameOfSheet").Range("C3").Copy
Destination:=Worksheets("NameOfSheet").Range("C10" )"



Richard

Copy / Paste Value
 
I think I might not have been very clear.


My problem is that I can easily copy and paste using 1 line of code. What I
am copying is a formula and I would like to simplify the code for copying and
pasting the VALUE, not the formula itself.

"I.R;))" wrote:

On 6 ruj, 13:00, Richard wrote:
I was very happy when I found that I could simplify my code when copy and
pasting to one line as follows

Range("Current_Prices").Copy Destination:=Range

However I would like to paste the value. Is this possible in one line or do
we have to make do with

Application.Goto Reference:="Current_Prices"
Selection.Copy
Application.Goto Reference:="Previous_Prices"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

Thanks in advance for your assistance


try with this "Worksheets("NameOfSheet").Range("C3").Copy
Destination:=Worksheets("NameOfSheet").Range("C10" )"




Richard

Copy / Paste Value
 
OK, Iknow have this down to 2 lines

Range("C8").Copy
Range("E10").PasteSpecial xlPasteValues

Is there any way to improve on this?

"I.R;))" wrote:

On 6 ruj, 13:00, Richard wrote:
I was very happy when I found that I could simplify my code when copy and
pasting to one line as follows

Range("Current_Prices").Copy Destination:=Range

However I would like to paste the value. Is this possible in one line or do
we have to make do with

Application.Goto Reference:="Current_Prices"
Selection.Copy
Application.Goto Reference:="Previous_Prices"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

Thanks in advance for your assistance


try with this "Worksheets("NameOfSheet").Range("C3").Copy
Destination:=Worksheets("NameOfSheet").Range("C10" )"




I.R))

Copy / Paste Value
 
On 7 ruj, 11:50, Richard wrote:
OK, Iknow have this down to 2 lines

Range("C8").Copy
Range("E10").PasteSpecial xlPasteValues

Is there any way to improve on this?


Yes!

Range("C8").Copy: Range("E10").PasteSpecial xlPasteValues





Dave Peterson

Copy / Paste Value
 
Not really an improvement, but another alternative:

with activesheet
.range("E10").value = .range("C8").value
end with



Richard wrote:

OK, Iknow have this down to 2 lines

Range("C8").Copy
Range("E10").PasteSpecial xlPasteValues

Is there any way to improve on this?

"I.R;))" wrote:

On 6 ruj, 13:00, Richard wrote:
I was very happy when I found that I could simplify my code when copy and
pasting to one line as follows

Range("Current_Prices").Copy Destination:=Range

However I would like to paste the value. Is this possible in one line or do
we have to make do with

Application.Goto Reference:="Current_Prices"
Selection.Copy
Application.Goto Reference:="Previous_Prices"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

Thanks in advance for your assistance


try with this "Worksheets("NameOfSheet").Range("C3").Copy
Destination:=Worksheets("NameOfSheet").Range("C10" )"




--

Dave Peterson

Dave Peterson

Copy / Paste Value
 
Personally, I wouldn't use this. Under most circumstances, I find this harder
to read.

"I.R;))" wrote:

On 7 ruj, 11:50, Richard wrote:
OK, Iknow have this down to 2 lines

Range("C8").Copy
Range("E10").PasteSpecial xlPasteValues

Is there any way to improve on this?


Yes!

Range("C8").Copy: Range("E10").PasteSpecial xlPasteValues


--

Dave Peterson


All times are GMT +1. The time now is 02:56 AM.

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