Copy Excel theme color in a new workbook

前端 未结 3 1888
不知归路
不知归路 2020-12-22 02:16

I want to make a macro that copies two sheets in a new workbook. But the theme color in the new created workbook is different.

Sub Export_File()
Dim Wb3 As Wo         


        
3条回答
  •  不思量自难忘°
    2020-12-22 02:17

    The Worksheet.Copy only takes the values, but if you set the script to copy the range of cells from one sheet to another, you can use PasteSpecial to copy both the values and the formats - example from this post

    Worksheets(1).Cells(i, 3).Copy
    Worksheets(2).Cells(a, 15).PasteSpecial Paste:=xlPasteFormats
    Worksheets(2).Cells(a, 15).PasteSpecial Paste:=xlPasteValues
    

提交回复
热议问题