|
|
|
|
|
|
Excel
|
Delete Conditional Formatting
|
|
Ease of Use
|
Easy
|
Version tested with
|
2000, 2002, 2003
|
Submitted by:
|
Zack Barresse
|
Description:
|
All selected cells will have the Conditional Formatting removed.
|
Discussion:
|
Conditional Formatting can be a very nice tool. In Excel's current versions, we can use up to 3 conditional formats to alter the appearance of cells (font, bold, italics, font color, background color, etc). It may be advantageous and time saving to delete these at the click of a button rather than going in and deleting them by hand for multiple cells. This code will delete all conditional formats within the users selected area with a confirmation box first.
|
Code:
|
instructions for use
|
Option Explicit
Public Sub DeleteCF()
If ActiveWorkbook Is Nothing Then
MsgBox "You must have a workbook open first!", vbInformation, "No Open Book"
Exit Sub
End If
If MsgBox("Delete all Conditional Formats from selection?", _
vbYesNo, "Remove Conditions") = vbNo Then Exit Sub
Selection.FormatConditions.Delete
End Sub
|
How to use:
|
- Copy above code.
- In Excel press Alt + F11 to enter the VBE (Visual Basic Editor).
- Press Ctrl + R to show the Project Explorer.
- Right-click desired file on left (in bold).
- Select Insert -> Module.
- Paste code into the right (blank) pane.
- Press Alt + Q to close the VBE.
- Save workbook before any other changes.
|
Test the code:
|
- Select all cells with conditional formats that you would like removed (can be non-contiguous).
- Press Alt + F8.
- Select 'DeleteCF'.
- Press Run.
|
Sample File:
|
DeleteCF.zip 7.35KB
|
Approved by mdmackillop
|
This entry has been viewed 148 times.
|
|