need some help here...
I´m trying to help my wife automate excel spreadsheet shes uses, and im not being able to solve this...
What i want to achieve:
When i click in a range of cells, i want that a specific number decrease in a cell and increase in other cell, at the same time.
In the example:
I insert number 22 in cell D4 (this define the maximum cells that will become selected)
When i click on a cell in that range off cells, this cell becomes green and the number in cell D4 decrease by one and in cell F4 the number increase by one, and so on for every cell in that range in a maximum off 22 clicks.
If i click the same cell again, the cell comes to normal (without the green overlay), and the number in cells D4 increase by one and in F4 decrease by one, do, do the inverse.
After 22 cells are selected and overlayed with green, if i continue to click nothing happen, for me to be able to make another cell green, i need to remove one of the previous selected cells.
i hope you guys understand...
I only have a code to change cell color by double click , and the spreasheet dont use any other code, only conditional formatting and formulas.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Select Case Target.Interior.ColorIndex
Case xlNone, 4: Target.Interior.ColorIndex = 4
End Select
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Target.Interior.ColorIndex = xlNone
End Sub
Please check the examples pictures: