Forum Discussion
Rajasekhar Bora
Mar 20, 2018Copper Contributor
Need to popuplate a cell with 'Y' or 'N' based on the check with multiple columns values
I am new to this Excel Macro, but now I need to write a code for below scenario. Appreciate your help.
I need to populate 'Y' or 'N' in a cell (Ex: A2) with color if 'Y' Green or 'N' Red, based o...
Logaraj Sekar
Mar 22, 2018Iron Contributor
Hi Rajasekhar Bora,
I just write macro for "Column A" only. If you got idea how to write for W, AE, AQ columns, do it your self. If not, i ll write the same above columns.
If this is not you expected, explain more.
Sub Mahi()
For b = 6 To 18
If Cells(b, 7).Value = "Y" And Cells(b, 13).Value = "Y" And Cells(b, 19).Value = "Y" And Cells(b, 22).Value = "Y" Then
Range("A" & b).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 5296274
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("A" & b).Value = "Y"
Else
Range("A" & b).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Range("A" & b).Value = "N"
End If