Referring to screen shot, I want to programmtically format a cell like so:
If cell B4 and cell F4 are both red text, then format cell J4 to be red text.
(and similarly for all other cells).
I see one can format a cell based on the value contained in another cell, but I'm not finding that you can base it on the format of the cell. Is this possible?
Add more info. As stated, I can see how to base a condition on a value of a cell. Here is an example:
Sub FormatUsingVBA()
Dim rng As Range
Dim lastRow As Long
lastRow = Cells(Rows.Count, 3).End(xlUp).Row
Set rng = Range("C2:C" & lastRow)For Each cell In rng
If cell.Value2 = "Adult" Then
Range(cell.Address).Offset(0, -2).Interior.ColorIndex = 3
ElseIf cell.Value2 = "KID" Then
Range(cell.Address).Offset(0, -2).Interior.ColorIndex = 4
ElseIf cell.Value2 = "Teenager" Then
Range(cell.Address).Offset(0, -2).Interior.ColorIndex = 6
Else
Range(cell.Address).Offset(0, -2).Interior.ColorIndex = 0
End If
Next cell
End Sub
So it has a condition based on the value in a cell (If cell.Value2 = "Adult"
). I want base it on the format of a cell and I don't see how to do this.
Entering macro command in cell