MSPaperclipMan
New Member
- Joined
- Jan 21, 2022
- Messages
- 5
- Office Version
- 2016
- Platform
- Windows
Hello,
I would like to color a cell based on another cell's color. However, I am running into an issue. I have tried the code shown below, and it does work to solve the question in hand. However, it stops working when I try to use the code with a cell which is "colored" by conditional formatting. Specifically, I am trying to color cell g25 if cell d25 shows as yellow. By appearance, cell d25 does look yellow (from the conditional formatting) but for some reason the code/excel doesn't "see" this and thinks the cell has no fill, and hence won't color cell g25 yellow as well. Only when I manually fill d25 with yellow does the code execute. Does anyone know a way around this? At the core, I am trying to color fill a cell based on another cell's color which will be filled with conditional formatting. I hope this made sense.
[Sub mycode()
If range("d25").Interior.ColorIndex = 6 Then
range("g25").Interior.ColorIndex = 6
End If
End Sub]
I would like to color a cell based on another cell's color. However, I am running into an issue. I have tried the code shown below, and it does work to solve the question in hand. However, it stops working when I try to use the code with a cell which is "colored" by conditional formatting. Specifically, I am trying to color cell g25 if cell d25 shows as yellow. By appearance, cell d25 does look yellow (from the conditional formatting) but for some reason the code/excel doesn't "see" this and thinks the cell has no fill, and hence won't color cell g25 yellow as well. Only when I manually fill d25 with yellow does the code execute. Does anyone know a way around this? At the core, I am trying to color fill a cell based on another cell's color which will be filled with conditional formatting. I hope this made sense.
[Sub mycode()
If range("d25").Interior.ColorIndex = 6 Then
range("g25").Interior.ColorIndex = 6
End If
End Sub]