Paste special vba

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:50 PM GMT

Question

i have created a macro with which, a range of cells are copied and pasted into a new generated workbook. however, the cells are copied without any color, even though in my original file there was color white. i guess i need to paste in special.... here my macro:

Sub english()

Sheets("PowerPallet").Select

   Range("a:f").Select
   Selection.Copy
   
       
   Workbooks.Add
   ActiveSheet.Paste


LMsg = "Copy has completed."

       LMsg = LMsg & Chr(10) & "You can view the new workbooks under the Windows menu."
   
   MsgBox LMsg

End Sub

Answer

It's odd as I would EXPECT that a paste would be a full paste generally, certainly by doing it manually that is what I get,but including

Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _

       SkipBlanks:=False, Transpose:=False

before your Lmsg line should give you the result you need.

Advertisement

©2021 eLuminary LLC. All rights reserved.