Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make conditional formatting static

Is there any way to convert conditional formatting to static formatting in Excel?

I'm trying to export a range of a Excel Sheet to a new Workbook, with identical appearance but no formulas, links, etc. The problem here is that I have conditional formatting that relies on calculations outside exported range.

I've tried saving the workbook to .html, oddly enough the formatting shows in IE but not when reopening it in Excel.

like image 564
Martin Avatar asked Jan 14 '11 15:01

Martin


People also ask

How do I lock conditional formatting in Excel?

Replies (3)  Unlock the cells that you have conditional formatting on but want the user to modify. Then protect the worksheet, using the default lock settings shown of "Select locked cells" and "Select unlocked cells". The cells can then be edited, but conditional formatting can't be changed.

How do I remove conditional formatting but keep color?

There are a few ways to remove conditional formatting but keep the effects. One way is to use the Clear Rules feature. To do this, select the cells that have the conditional formatting that you want to remove. Then, go to Home > Styles > Clear Rules.

Is conditional formatting dynamic?

Conditional Formatting in Excel allows you to format cells based on the value of the cell. So, most conditional formatting in Excel is Dynamic Conditional formatting. This is because the formatting will change as the values of the cells change.


2 Answers

I am suggesting you a much easier approach which will work all the time. I also tried hard with VBA but it was so difficult that I left in middle.

To convert conditional formatting to static,we will first convert Excel to Html(webpage) and then back to excel. Please follow below approach.

1. Load the workbook that contains your conditional formatting.
2. Save the workbook as an HTML file(as webpage). 
(Press F12, specify the HTML format, and give the workbook a different name.)
3. Restart Excel.
4. Load into Excel the HTML file you saved in step 2.
5. Save the workbook as an Excel workbook. 
(Press F12, specify an Excel workbook format, and give the workbook a different name.)

In the process of saving the Excel workbook in HTML format, the program "strips" all the conditional formatting and makes it explicit (absolute). You should be aware, however, that this process also does the same with your formulas, saving everything as a value, instead.

like image 188
Ashish Anand Avatar answered Oct 14 '22 20:10

Ashish Anand


This approach seems to work well. I've only implemented it for background colours.

Sub FixColor()
    Dim r
    For Each r In Selection
        r.Interior.Color = r.DisplayFormat.Interior.Color
    Next r
    Selection.FormatConditions.Delete
End Sub
like image 26
pooroldpedro Avatar answered Oct 14 '22 19:10

pooroldpedro