ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy & Paste (Merged & Centered) (https://www.excelbanter.com/excel-programming/354127-copy-paste-merged-centered.html)

Cathy[_2_]

Copy & Paste (Merged & Centered)
 
In Sheet1, I have Cells A1:D1 "Merged & Centered" with bold letters for
the title of the page

I am trying to write a macro top copy and Paste the Text from A1:C1 to
Sheet2!D2 (after inserting a new column in D2)

The problem is that after pasting in D2, the contents of E2 and F2 are
also cleared as it seems because the copied area is merged over three
cells, the pasted area is pasted over three cells.

Is there a way I could make this only Paste in Cell D2

For reference, this is what I am using:
Sheets("Sheet1").Select
Range("A1").Select
Selection.Copy
Sheets("Sheet2").Select
Range("D2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False

Thanks in advance

Cathy



Dave Peterson

Copy & Paste (Merged & Centered)
 
Maybe just assigning the value would work better:

Worksheets("sheet2").Range("D2").Value _
= Worksheets("sheet1").Range("a1").Value



Cathy wrote:

In Sheet1, I have Cells A1:D1 "Merged & Centered" with bold letters for
the title of the page

I am trying to write a macro top copy and Paste the Text from A1:C1 to
Sheet2!D2 (after inserting a new column in D2)

The problem is that after pasting in D2, the contents of E2 and F2 are
also cleared as it seems because the copied area is merged over three
cells, the pasted area is pasted over three cells.

Is there a way I could make this only Paste in Cell D2

For reference, this is what I am using:
Sheets("Sheet1").Select
Range("A1").Select
Selection.Copy
Sheets("Sheet2").Select
Range("D2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False

Thanks in advance

Cathy


--

Dave Peterson


All times are GMT +1. The time now is 06:33 PM.

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