Using Excel 2000</SPAN></SPAN>
Hi,</SPAN></SPAN>
I want to colour C:P columns as per values are set in the column R:Z, the macro were written by MickG, I been able to modified it get it work to colour row 6 only, I am not able to set all range from R6:Z19. After I run code it get stuck and highlight the line below </SPAN></SPAN>
"With Cells(r1 + r, 3 + c).Resize(, Dn.Value)"</SPAN></SPAN>
Please need help to make it work or please rewrite new one </SPAN></SPAN>
Thank you in advance</SPAN></SPAN>
Regards,</SPAN>
Kishan</SPAN></SPAN>
Hi,</SPAN></SPAN>
I want to colour C:P columns as per values are set in the column R:Z, the macro were written by MickG, I been able to modified it get it work to colour row 6 only, I am not able to set all range from R6:Z19. After I run code it get stuck and highlight the line below </SPAN></SPAN>
"With Cells(r1 + r, 3 + c).Resize(, Dn.Value)"</SPAN></SPAN>
Code:
Sub MG16Sep23()
Dim Rng As Range, Dn As Range, r As Long, r1 As Long, c As Long, num As Long, Col As Variant
Set Rng = Range(Range("R6"), Range("R" & Columns.Count).End(xlToRight))
Col = Array(10, 3)
r1 = 6
r = 0
c = 0
For Each Dn In Rng
With Cells(r1 + r, 3 + c).Resize(, Dn.Value)
.Interior.ColorIndex = Col(num)
.Font.ColorIndex = 2
End With
c = c + Dn.Value
If c = 14 Then c = 0 & r1 = r1 + 1
num = num + 1
num = IIf(num = 2, 0, num)
Next Dn
End Sub
Please need help to make it work or please rewrite new one </SPAN></SPAN>
Book1 | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | AA | AB | |||
1 | ||||||||||||||||||||||||||||||
2 | ||||||||||||||||||||||||||||||
3 | ||||||||||||||||||||||||||||||
4 | ||||||||||||||||||||||||||||||
5 | C1 | C2 | C3 | C4 | C5 | C6 | C7 | C8 | C9 | C10 | C11 | C12 | C13 | C14 | v1 | v2 | v3 | v4 | v5 | v6 | v7 | v8 | v9 | |||||||
6 | X | 1 | 2 | 1 | 2 | X | X | 1 | 1 | 2 | 1 | X | 2 | 2 | 1 | 2 | 2 | 2 | 3 | 4 | ||||||||||
7 | 1 | X | 2 | 2 | 2 | 1 | X | X | 2 | 2 | X | X | 1 | 1 | 5 | 5 | 2 | 2 | ||||||||||||
8 | 1 | X | 1 | 1 | X | X | 2 | 2 | X | X | 1 | 1 | X | X | 2 | 6 | 2 | 4 | ||||||||||||
9 | 1 | X | 1 | 2 | 2 | 1 | X | 1 | 1 | X | 1 | 2 | 2 | 1 | 2 | 3 | 2 | 6 | 1 | |||||||||||
10 | X | 1 | X | 1 | X | 1 | 1 | X | 1 | 1 | 1 | X | X | 1 | 1 | 2 | 1 | 3 | 5 | 1 | ||||||||||
11 | X | X | X | 1 | 1 | 1 | 1 | X | 1 | X | 2 | 1 | 2 | X | 3 | 5 | 3 | 2 | 1 | |||||||||||
12 | 2 | X | 1 | 1 | 1 | 2 | X | X | X | 1 | 1 | 1 | 2 | 1 | 1 | 1 | 4 | 3 | 4 | 1 | ||||||||||
13 | X | 1 | X | X | 1 | 1 | 1 | 1 | 1 | 1 | 1 | X | 1 | 1 | 1 | 3 | 8 | 2 | ||||||||||||
14 | 2 | 1 | 1 | X | 2 | 1 | 1 | X | 2 | X | 2 | 2 | 2 | X | 1 | 4 | 4 | 4 | 1 | |||||||||||
15 | X | 1 | 1 | 2 | X | 1 | 2 | 1 | 1 | 1 | 1 | 1 | 1 | X | 1 | 3 | 1 | 2 | 7 | |||||||||||
16 | 1 | 2 | 1 | 2 | X | 2 | 1 | X | 1 | 2 | X | 1 | 1 | 1 | 2 | 2 | 2 | 2 | 2 | 1 | 3 | |||||||||
17 | 2 | X | X | 1 | 2 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 1 | X | 1 | 2 | 3 | 4 | 4 | |||||||||||
18 | 1 | 1 | 1 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 2 | 1 | X | X | 5 | 4 | 2 | 3 | ||||||||||||
19 | 1 | 2 | 1 | 2 | 1 | 1 | 1 | 2 | 2 | 1 | 2 | 1 | 1 | X | 2 | 2 | 5 | 2 | 3 | |||||||||||
20 | ||||||||||||||||||||||||||||||
21 | ||||||||||||||||||||||||||||||
Sheet8 |
Thank you in advance</SPAN></SPAN>
Regards,</SPAN>
Kishan</SPAN></SPAN>
Last edited: