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

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
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,214,814
Messages
6,121,711
Members
449,049
Latest member
THMarana

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