VBA Code to Select the whole sheet, delete Cond Format

MFish

Board Regular
Joined
May 9, 2019
Messages
76
Hi there,

I have a VBA code that I use to delete CF, conditional format, and then reapply that same CF once the macro is done deleting/inserting a row. Here it is...

Code:
    With Worksheets("Input new run").Range("B7:T10000")
        .FormatConditions.Delete
    End With

'Add the CF of alternating unique ID's

    With Range("B7:T10000").FormatConditions.Add( _
        Type:=xlExpression, _
    Formula1:="=AND(ISODD($A7),ROW()>1)")
    
        .Interior.Color = RGB(178, 178, 178)
        
    
    End With

My question is... How do I actually delete the WHOLE spreadsheet of Conditional formatting, maybe only Columns B:T?, and reapplying a CF that states if cell is blank then please fill in with RGB(242,242,242).
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Solved, to the best of my knowledge... I just wrote this...
Code:
With Worksheets("Input new run").Range("B7:T10000")     .FormatConditions.Delete
    With .FormatConditions.Add(Type:=xlExpression, Formula1:="=B7=TEXT(,)")
        .Interior.Color = RGB(242, 242, 242)
    End With
End With
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,825
Members
449,190
Latest member
rscraig11

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