I have this code in vba that defines arrays for column headers that I want copy/pasted in another tab in Excel. However, in one of the new tabs, I also want to color code some cells based on their value in the column "BOM PROCESS TYPE (A, U, R, D)" which corresponds to position 2 in that array. The code runs without giving me an error, but the cells don't change color at all. Skipping some parts, this is what I have, does anyone know how to fix it?
'My variables.
Dim i As Long, rngCell As Range, rCell As Range
Dim c As Long, v As Long, vMHDRs As Variant, vBHDRs As Variant
Dim s As Long, vNWSs As Variant, wsMM As Worksheet
vBHDRs = Array("BOM LEVEL", "BOM PROCESS TYPE (A, U, R, D)", "ALTERNATIVE ITEM: GROUP")
'Skipping most of the code and jumping to the color coding section:
With Sheets("BOM")
v = 2
Set rngCell = Sheets("BOM").UsedRange.Find(What:=vBHDRs(v), LookAt:=xlWhole)
If Not rngCell Is Nothing Then
Set rngCell = Intersect(Sheets("BOM").UsedRange, rngCell.EntireColumn)
For Each rCell In rngCell
If rCell.Value = "D" Then rCell.Interior.ColorIndex = 3
If rCell.Value = "R" Then rCell.Interior.ColorIndex = 6
If rCell.Value = "U" Then rCell.Interior.ColorIndex = 6
Next
End If
End With
Any thoughts?