VBA Copy/Save as -> missing formatting

srosk

Board Regular
Joined
Sep 17, 2018
Messages
132
I have code to export / copy sheets to a new workbook. The issue is, some of the color formatting is missing. Can someone help answer why?

Code:
Sub Report6Export()
   Dim Fname As String, ws As Worksheet
   Dim Ary As Variant, tmp As Variant
   Dim i As Long
   Fname = "Review - " & Sheets("Instructions").Range("D5").Value
   Ary = Array("Summary Page", Data Review", "Date Data Review", "Override Review", "Tenure Discrepancy Review", "Report - All Data")
      tmp = Ary
   For i = 0 To UBound(Ary)
      If Not Evaluate("isref('" & Ary(i) & "'!A1)") Then
         tmp = Filter(tmp, Ary(i), False, vbTextCompare)
      End If
   Next i
   Sheets(tmp).Copy
   For Each ws In ActiveWorkbook.Worksheets
       With ws.UsedRange
           .Value = .Value
       End With
   Next ws
   With ActiveWorkbook
       .SaveAs ThisWorkbook.Path & "\" & (Fname)
       .Close
   End With
End Sub

It is only an issue on the summary sheet where cells are highlighted a certain color. The color changes to a different color on a new sheet. Example... header cells are color 31,73,125.. however... on the copied sheet.. they are color 68,84,106

Is there a simple way to resolve this? Ty!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top