I'm currently using the following code to fill a row of up to 7 cells with the colour yellow, dependent on where in that row I click.
so, for example, if I click in cell G3, cells C3 to G3 will fill with yellow.
If I were to click in J7, then cells C7 to J7 would fill with yellow.
The code also allows me to change my mind, and click a different cell within a row that I've already clicked a 'shade-range', and choose a different cell to fill up to.
Is there a way to alter the code so that I get a gradual change of colours (let's say from red through to green) from left to right, up to where I click.
So, for example ...
* if I click in cell C3, C3 would be filled with red
* if I click in cell D3, C3 would be filled with red, and D3 would be filled with a slightly less red
* if I click in cell E3, C3 would be filled with red, D3 would be filled with a slightly less red, E3 would be filled with something a bit more orange
etc etc etc where if I were to click on the right-most cell in the row, let's say L3, I'd have a gradual range of colours from bright red in C3 through to bright green in L3.
The colour range is to reflect bad (alarming red on the left) through to good (affirming green on the right)
Is this possible ?
so, for example, if I click in cell G3, cells C3 to G3 will fill with yellow.
If I were to click in J7, then cells C7 to J7 would fill with yellow.
The code also allows me to change my mind, and click a different cell within a row that I've already clicked a 'shade-range', and choose a different cell to fill up to.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iColor As Integer
If Intersect(Target, Range("C3:L8")) Is Nothing Then Exit Sub
iColor = Target.Interior.ColorIndex
If iColor < 0 Then iColor = 6
Rows(Target.Row).FormatConditions.Delete
With Range("C" & Target.Row, Target.Address) 'Rows(Target.Row)
.FormatConditions.Add Type:=2, Formula1:=1
.FormatConditions(1).Interior.ColorIndex = iColor
End With
End Sub
Is there a way to alter the code so that I get a gradual change of colours (let's say from red through to green) from left to right, up to where I click.
So, for example ...
* if I click in cell C3, C3 would be filled with red
* if I click in cell D3, C3 would be filled with red, and D3 would be filled with a slightly less red
* if I click in cell E3, C3 would be filled with red, D3 would be filled with a slightly less red, E3 would be filled with something a bit more orange
etc etc etc where if I were to click on the right-most cell in the row, let's say L3, I'd have a gradual range of colours from bright red in C3 through to bright green in L3.
The colour range is to reflect bad (alarming red on the left) through to good (affirming green on the right)
Is this possible ?