ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA: Pasted Cells Not Formatted (https://www.excelbanter.com/excel-programming/335327-vba-pasted-cells-not-formatted.html)

ajocius[_3_]

VBA: Pasted Cells Not Formatted
 

When I do a paste special, the cells being pasted don't format
themselves like the cells where I did the copy from. See my structure
below:

'Select Sheet
Sheets("Previous").Select

'Select Cells
Range("A2:B5").Select
Selection.Copy

'Select Sheet
Sheets("Summary").Select
Range("A2:B5").Select

'Do Paste Special
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False

Again, just a novice........but love learning this VBA


Tony


--
ajocius
------------------------------------------------------------------------
ajocius's Profile: http://www.excelforum.com/member.php...o&userid=17695
View this thread: http://www.excelforum.com/showthread...hreadid=389591


JE McGimpsey

VBA: Pasted Cells Not Formatted
 
What formatting isn't copied (font and cell formats copy for me)?

Note that you don't need to select anything. Your macro could be
replaced with one line:

Sheets("Previous").Range("A2:B5").Copy Destination:= _
Sheets("Summary").Range("A2:B5")

Or, if you want to use Paste Special, two:

Sheets("Previous").Range("A2:B5").Copy
Sheets("Summary").Range("A2").PasteSpecial _
Paste:=xlPasteAll, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False


In article ,
ajocius wrote:

When I do a paste special, the cells being pasted don't format
themselves like the cells where I did the copy from. See my structure
below:

'Select Sheet
Sheets("Previous").Select

'Select Cells
Range("A2:B5").Select
Selection.Copy

'Select Sheet
Sheets("Summary").Select
Range("A2:B5").Select

'Do Paste Special
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:=False, Transpose:=False

Again, just a novice........but love learning this VBA


Tony



All times are GMT +1. The time now is 02:10 PM.

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