I've managed to steal/create the code I wanted to allow me to create multiple conditional formats (56 ish, although some of the colours are very similar)... (see bottom).. If someone want to let me know how to reduce this code, please feel free!
When manually entering values into the worksheet it works just fine.
However, when I copy > paste special (Alt+P) a load of values into my sheet the code doesn't function.
However if I select and return (F2, Enter) any fo those copied cells the formatting is then applied.
Is there a way to auto-apply the select/enter process to all the cells, so that the formatting activates..?
Here's the (probably very long-winded) code I'm using....
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
'define range where you want colours to happen...
If Not Intersect(Target, Range("A1:BA100")) Is Nothing Then
Select Case Target
'the cells error above 56 colours... so I stopped there, I'm sure this can be trimmed down though... i.e. "Case = icolor", or something similar...
Case 1
icolor = 1
Case 2
icolor = 2
Case 3
icolor = 3
Case 4
icolor = 4
Case 5
icolor = 5
Case 6
icolor = 6
Case 7
icolor = 7
Case 8
icolor = 8
Case 9
icolor = 9
Case 10
icolor = 10
Case 11
icolor = 11
Case 12
icolor = 12
Case 13
icolor = 13
Case 14
icolor = 14
Case 15
icolor = 15
Case 16
icolor = 16
Case 17
icolor = 17
Case 18
icolor = 18
Case 19
icolor = 19
Case 20
icolor = 20
Case 21
icolor = 21
Case 22
icolor = 22
Case 23
icolor = 23
Case 24
icolor = 24
Case 25
icolor = 25
Case 26
icolor = 26
Case 27
icolor = 27
Case 28
icolor = 28
Case 29
icolor = 29
Case 30
icolor = 30
Case 31
icolor = 31
Case 32
icolor = 32
Case 33
icolor = 33
Case 34
icolor = 34
Case 35
icolor = 35
Case 36
icolor = 36
Case 37
icolor = 37
Case 38
icolor = 38
Case 39
icolor = 39
Case 40
icolor = 40
Case 41
icolor = 41
Case 42
icolor = 42
Case 43
icolor = 43
Case 44
icolor = 44
Case 45
icolor = 45
Case 46
icolor = 46
Case 47
icolor = 47
Case 48
icolor = 48
Case 49
icolor = 49
Case 50
icolor = 50
Case 51
icolor = 51
Case 52
icolor = 52
Case 53
icolor = 53
Case 54
icolor = 54
Case 55
icolor = 55
Case 56
icolor = 56
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub
When manually entering values into the worksheet it works just fine.
However, when I copy > paste special (Alt+P) a load of values into my sheet the code doesn't function.
However if I select and return (F2, Enter) any fo those copied cells the formatting is then applied.
Is there a way to auto-apply the select/enter process to all the cells, so that the formatting activates..?
Here's the (probably very long-winded) code I'm using....
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
'define range where you want colours to happen...
If Not Intersect(Target, Range("A1:BA100")) Is Nothing Then
Select Case Target
'the cells error above 56 colours... so I stopped there, I'm sure this can be trimmed down though... i.e. "Case = icolor", or something similar...
Case 1
icolor = 1
Case 2
icolor = 2
Case 3
icolor = 3
Case 4
icolor = 4
Case 5
icolor = 5
Case 6
icolor = 6
Case 7
icolor = 7
Case 8
icolor = 8
Case 9
icolor = 9
Case 10
icolor = 10
Case 11
icolor = 11
Case 12
icolor = 12
Case 13
icolor = 13
Case 14
icolor = 14
Case 15
icolor = 15
Case 16
icolor = 16
Case 17
icolor = 17
Case 18
icolor = 18
Case 19
icolor = 19
Case 20
icolor = 20
Case 21
icolor = 21
Case 22
icolor = 22
Case 23
icolor = 23
Case 24
icolor = 24
Case 25
icolor = 25
Case 26
icolor = 26
Case 27
icolor = 27
Case 28
icolor = 28
Case 29
icolor = 29
Case 30
icolor = 30
Case 31
icolor = 31
Case 32
icolor = 32
Case 33
icolor = 33
Case 34
icolor = 34
Case 35
icolor = 35
Case 36
icolor = 36
Case 37
icolor = 37
Case 38
icolor = 38
Case 39
icolor = 39
Case 40
icolor = 40
Case 41
icolor = 41
Case 42
icolor = 42
Case 43
icolor = 43
Case 44
icolor = 44
Case 45
icolor = 45
Case 46
icolor = 46
Case 47
icolor = 47
Case 48
icolor = 48
Case 49
icolor = 49
Case 50
icolor = 50
Case 51
icolor = 51
Case 52
icolor = 52
Case 53
icolor = 53
Case 54
icolor = 54
Case 55
icolor = 55
Case 56
icolor = 56
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub