VBA help - to apply conditional format

bbalch

Board Regular
Joined
Feb 23, 2015
Messages
61
I need some help making modifications to vba that applies conditional formats to one of my reports. The existing macro creates a conditional format and copies the format over the entire report.


The vba I use creates a conditional format on cell $A8 and bolds the cell if it starts with " [" then copies the conditional format throughout the report Range(A9:S500). This macro is based on data starting in A8. For example, the macro would make the rows below bold for [504050_Allocation_AdminExps], [510150_BankFees], and [510150_TotalBankFees]. I'm trying to copy and modify the vba to make 2 new conditional formats.


1. Apply the "Top and Bottom Border" to cells that contain "Total"
2. Apply the "Top and Double Bottom Border" to cells that contain "ABC Net Gain"

Column A

[Expenses]Expenses
[504050_Allocation_AdminExps] Allocation Admin Expense
[510150_BankFees] Bank Fees
item 1
item 2
item 3
[510150_BankFees] Total Bank Fees
[TotalABCExpense] Total ABC Expense
[ABCNETGAIN] ABC Net Gain




Existing Macro:


' Conditional Format

Range("A8").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=(LEFT($A8,3)="" ["")"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Selection.Copy
Range("A9:S500").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False




Any help or suggestions are greatly appreciated. Thanks in advance for your help!
Ben
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,216,100
Messages
6,128,825
Members
449,470
Latest member
Subhash Chand

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