Forum Discussion
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 on a check with multiple column values.
I need to check on columns G, M, S, V. If any of these column values has 'N' then I need to populate cell A2 with 'N'( with Red color in Cell) Else 'Y' with Green in Cell.
Similarly for W2, if column AD has 'N' then populate cell W2 with 'N' color Red Else 'Y' with Green
Similarly for AE2, if columns AJ and AP has N then populate cell AE2 with 'N' color Red Else 'Y' with Green
Similarly for AQ, if column AT has 'N' then populate cell AQ with 'N' color Red Else 'Y' with Green
Note: All the cell Column values need to be validated from row 6
Attached the file, please help me on that.
Thanks,
Raj
- Rajasekhar BoraCopper Contributorcan someone help me with the VBA script, appreciate your help.
Thanks,
Rajasekhar - Logaraj SekarSteel 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