VBA code to remove all highlighting (but orange) and bold font.

Drewbert34

New Member
Joined
Jun 21, 2011
Messages
26
Hello all,

Please excuse my newbieness but I need help with some VBA code. I have a workbook that has Orange (cancellations) Green (changes) and Bold font (new additions). Every Friday I need to run a macro that will:

1. Select all inputs by filtering out blank cells on column A giving me my range. This will be an expanded range every week.

2. Remove all Bold font from the selected range in step 1.

3. Filter column B for unhighlighted cells (no fill). Filtering this column will exclude Orange highlighted cells which are cancellations and need to remian permananetly Orange (range A:AT). This column will never have green highlighted cells so by using this column to filter by I should be left with all "No fill" cells and any Green highlighted cells throughout the range.

4. No fill the filtered range which *should* remove and green highlighting on the sheet.

5. Remove the filters.

Below is the code my limited experience has come up with. if I perform these steps manually it works every time. If I run the code it always leaves behind the Green highlighted cells that I wish to be no fill.

Can someone help me simplify or correct my code so that it works?

Thank You!








Sub RemoveGreenBold2()
'
' RemoveGreenBold2 Macro
'
'
ActiveSheet.Range("$A$6:$AU$293").AutoFilter Field:=3, Criteria1:="<>"
Range("A7:AU7").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Font.Bold = False
ActiveSheet.Range("$B$6:$AU$293").AutoFilter Field:=3, Operator:= _
xlFilterNoFill
Range("B7:AU7").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Font.Bold = False
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveSheet.Range("$A$6:$AU$293").AutoFilter Field:=3
End Sub
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I believe I see my mistakes. I fixed some things and it seems to work. Thanks to all that took a look:

Sub RemoveGreenBold2()
'
' RemoveGreenBold2 Macro
'
'
ActiveSheet.Range("$A$6:$AU$293").AutoFilter Field:=1, Criteria1:="<>"
Range("A7:AT7").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Font.Bold = False
ActiveSheet.Range("$B$6:$AU$293").AutoFilter Field:=2, Operator:= _
xlFilterNoFill
Range("B7:AT7").Select
Range(Selection, Selection.End(xlDown)).Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveSheet.Range("$A$6:$AU$293").AutoFilter Field:=1
ActiveSheet.Range("$A$6:$AT$293").AutoFilter Field:=2
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,596
Messages
6,179,807
Members
452,944
Latest member
2558216095

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