Display text in cell

I am building a macro (below) which changes the text "This is Brown colour" to "Brown" in col D. This works perfect. now in Col G (same row) I need to add "A" if the result in D is "Brown" and "B" if the result in D is "Red". Please help.

Sub Adv_Cert()
'
' Adv_Cert Macro
'
Columns("D:D").Select
Range("D2").Select
ActiveCell.FormulaR1C1 = _
"This is Brown colour"
Cells.Replace What:= _
"This is Brown colour", Replacement:= _
"Brown", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False

Columns("D:D").Select
Range("D2").Select
ActiveCell.FormulaR1C1 = _
"This is Red colour"
Cells.Replace What:= _
"This is Red colour", Replacement:= _
"Red", LookAt:=xlPart, SearchOrder:= _
xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False

End Sub

Reply...

Reply me

IF Statement in Excel Column

=IF(D2="Brown","A","B")
This works for me, while I run your code using F8.