View Full Version : [SOLVED:] Add Border if Statement
Emoncada
06-18-2008, 06:52 AM
I want to add a Border if a cell value = "a"
So if(D9="a","Add Bottom Line Border","")
How can I get this to work either in vb or in a formula?
RonMcK
06-18-2008, 07:08 AM
You probably can get this done using Conditional Formatting.
Select Format > Conditional formatting...
In dialog, click dropdown, change 'Cell value is' to 'Formula is'
Enter '=d9="a"' in next text box (w/o the single quote marks)
click Format button
click Border tab
select border edge(s) and line type/weight
click 'OK'
click 'OK'
If your formatting applies to all cells in a range, highlight range before selecting Format > Conditional formatting.
If formatting for a row depending on a value in a specific column, type the formula with a '$' as: '=$d9="a"'.
If formatting for a column depends on a value in a specific row, type the formula with a '$' as: '=d$9="a"'.
Good luck!
marshybid
06-18-2008, 07:09 AM
I want to add a Border if a cell value = "a"
So if(D9="a","Add Bottom Line Border","")
How can I get this to work either in vb or in a formula?
Hi there,
I just recorded this as a macro in excel
Sub CondUnderline()
' CondUnderline Macro
range("D9").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""a"""
With Selection.FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End Sub
seems to work
Marshybid
Use conditional formatting. Do the following:
Select the cell.
Click Format from the toolbar
Click Conditional Formatting
In the conditional Formatting window:
Select - Cell Value Is
Select - equal to
Enter ="a" as the value equal to
Click the Format button
Click the Border tab
Click the bottom border
Click OK
Click OK
Alan
Emoncada
06-18-2008, 08:32 AM
Perfect Thanks.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.