Conditional Formatting lost on Copying cells

GAJITCS

Board Regular
Joined
Apr 21, 2015
Messages
66
I have a table that is subjected to conditional formatting and works exactly as required.

I have the need to copy that table and save it in it's own workbook and this is where the problem is.

The code used is as follows:

Dim Pth As String

Pth = ThisWorkbook.Path
Sheets("Export To Excel").Copy
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Pth & "" & ("Routing Map") & " " & Format(Now, "yyyy-dd-mm hh_mm_ss") & ".xlsx", 51
Application.DisplayAlerts = True
ActiveWorkbook.Close False

Stepping into the code, all is well until after the third line - Sheets("Export To Excel").Copy

There after, when the copied data arrives in a new workbook, the colours applied with the conditional formatting are completely different to those present when the "Copy" takes place.

Ignoring the VBA, the same thing happens when I just try to copy and paste the table from the source workbook into a new workbook. If I copy from source worksheet to a new worksheet in the same workbook, it's all okay.

Looks like the issue is copying between workbooks and the links to the conditions of the formatting.

I don't know where to start looking.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Possible workaround (not tested)
- Save the workbook under a different name
- delete what you don't want
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,541
Members
449,089
Latest member
davidcom

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