Hi
I am having trouble getting a map I created out of shapes to colour each shape in based on table values, I want for instance a shape I have named NR to lookup NR in a table and if the value in column 3 is between £0 and £10,000 to go red, £10,000 and £50,000 yellow, over £50,000 green.
I have found a code on another thread which did part of the work but I cant seem to manipulate it to work my spreadsheet, I am very new to VBA.
The code I have is;
Sub Worksheet_Change(ByVal Target As Range)
Dim shp As Shape
Dim Zone As Long
Dim r As Long, g As Long, b As Long
If Target.Address = "$B$3" Then
With Worksheets("Map")
For Each shp In .Shapes
Zone = WorksheetFunction.VLookup(shp.Name, Worksheets("Map").Range("u4:x130"), 3, False)
On Error Resume Next
Select Case Zone
Case 1
r = 255
g = 100
b = 100
Case 2
r = 100
g = 255
b = 100
Case 3
r = 100
g = 100
b = 255
End Select
shp.Fill.ForeColor.RGB = RGB(r, g, b)
Next shp
End With
End If
End Sub
as you can see B3 is a dropdown ("Premium" and "Commission") and when changed id like the colours to update, but if possible also move the lookup to;
Zone = WorksheetFunction.VLookup(shp.Name, Worksheets("Map").Range("u4:x130"), 4, False)
Any help is very appreciated.
Thank you
Dustin
Bookmarks