Hello everyone,
I am trying to create an IF statement using VBA to format the cells in a row (columns A:H) if certain text is found in column A.
The workbook contains account names in Column A. If the name in Column A = "Total Operating Income", "Total Expense", "Total Non-Operating Income", or "Total Income" I would like to apply the format below to the cells in A:H of that row. If the name in Column A does not contain one of the names listed no formatting changes need to be made. The account names in column A start in cell A6 and continue down anywhere from 10 - 150 rows (depending on how many accounts are used by the department).
Any suggestions on how to incorporate an if statement to format cells based on the text contents found in column A?
Thanks in advance for your help.
I am trying to create an IF statement using VBA to format the cells in a row (columns A:H) if certain text is found in column A.
The workbook contains account names in Column A. If the name in Column A = "Total Operating Income", "Total Expense", "Total Non-Operating Income", or "Total Income" I would like to apply the format below to the cells in A:H of that row. If the name in Column A does not contain one of the names listed no formatting changes need to be made. The account names in column A start in cell A6 and continue down anywhere from 10 - 150 rows (depending on how many accounts are used by the department).
Code:
Range("A:H").Select With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.249977111117893
.PatternTintAndShade = 0
End With
Selection.Font.Bold = True
Any suggestions on how to incorporate an if statement to format cells based on the text contents found in column A?
Thanks in advance for your help.