sanilmathews
Board Regular
- Joined
- Jun 28, 2011
- Messages
- 102
Hi All,
I would need a code for the below requirement on Worksheet_Change with each change in an ActiveCell.
A random cell (say A2) would be blank and also interior color as "No fill" initially. When there is first data input in cell A2, the cell color would change to yellow. For each instance of input the color would change for the cell A2. With this I could identify on how many instances of input was done on the same cell (i.e. A2) by a user using color code.
Initial = No fill
First input = Green
Second Input = Yellow
Third Input = Orange
Fourth Input and beyond = Red
I have the below code which is actually not giving what is expected. However I would appreciate if I can get a code that actually meets the above requirement.
I would need a code for the below requirement on Worksheet_Change with each change in an ActiveCell.
A random cell (say A2) would be blank and also interior color as "No fill" initially. When there is first data input in cell A2, the cell color would change to yellow. For each instance of input the color would change for the cell A2. With this I could identify on how many instances of input was done on the same cell (i.e. A2) by a user using color code.
Initial = No fill
First input = Green
Second Input = Yellow
Third Input = Orange
Fourth Input and beyond = Red
I have the below code which is actually not giving what is expected. However I would appreciate if I can get a code that actually meets the above requirement.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Interior.ColorIndex = -4142 Then ActiveCell.Interior.ColorIndex = 43
If ActiveCell.Interior.ColorIndex = 43 Then ActiveCell.Interior.ColorIndex = 6
If ActiveCell.Interior.ColorIndex = 6 Then ActiveCell.Interior.ColorIndex = 44
If ActiveCell.Interior.ColorIndex = 44 Then ActiveCell.Interior.ColorIndex = 22
End Sub