NamssoB
Board Regular
- Joined
- Jul 8, 2005
- Messages
- 76
- Office Version
- 365
- 2016
- Platform
- Windows
I need to set a cells background color (and potentially the text color), but without using Conditional Formatting.
Column G contains a word (Pending, Complete, Scheduled)
Column H contains a dollar value
Column I is what I am manipulating.
The current formula in Column I is as follows:
This is super simple - based on what is in G, it copies the dollar value from H to I. What I need to add is that if G30="Pending", I also want to COLOR cell I to be a light yellow background.
1) Is there already a way to do this?
2) If NO, and I use a VBA Function, how do I structure the VBA function so that it works for all cells in Column I, without hard coding a specific cell?
Column I Formula:
Function Code:
I figured that I have to also populate the value into the cell because you can't perform two things inside the True leg of the IF statement. Or am I missing something there also?
Column G contains a word (Pending, Complete, Scheduled)
Column H contains a dollar value
Column I is what I am manipulating.
The current formula in Column I is as follows:
Code:
=IF(G30="Pending",H30,IF(G30="Complete",H30,""))
This is super simple - based on what is in G, it copies the dollar value from H to I. What I need to add is that if G30="Pending", I also want to COLOR cell I to be a light yellow background.
1) Is there already a way to do this?
2) If NO, and I use a VBA Function, how do I structure the VBA function so that it works for all cells in Column I, without hard coding a specific cell?
Column I Formula:
Code:
=IF(G30="Pending",SetColor(H30,"Yellow"),IF(G30="Complete",H30,""))
Function Code:
Code:
Function SetColor(strColor as String, dblValue as Double)
Cell.Color.Background=strColor
Cell.Value = dblValue
End Function
I figured that I have to also populate the value into the cell because you can't perform two things inside the True leg of the IF statement. Or am I missing something there also?