|
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Dim arr(1 To 7), brr(1 To 7), a$, n&, i&, r&
If Target.Column = 5 And Target.Row > 4 Then
arr(1) = 0
brr(1) = Cells(3, "t").Interior.Color
For i = 2 To 7
a = Cells(i + 1, "u")
n = InStr(a, "-") + InStr(a, "<")
arr(i) = Val(Mid(a, n + 1, 15))
brr(i) = Cells(i + 2, "t").Interior.Color
Next
For i = 5 To Cells(Rows.Count, 3).End(3).Row
Me.Shapes(Cells(i, 3).Value).Select
If Err Then GoTo xxx
n = Application.Lookup(Cells(i, 5), arr, brr)
r = n Mod 256
g = n \ 256 Mod 256
b = n \ 256 \ 256 Mod 256
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(r, g, b)
xxx: Err.Clear
Next
End If
[a1].Select
End Sub
|
|