Ich versuche ein Dashboard/Choropleth. Ich habe Europa von here.Choropleth, die Farbe und die Daten
heruntergeladen Ich werde es einfach das erste Ding behalten, das ich tun möchte, ist, die graue und schwarze Farbe zu ändern. Zu blau. Kann jemand helfen?? Der Code, der mit der Vorlage kam unter
Option Explicit
Function udf_RGB(myR As Byte, myG As Byte, myB As Byte) As Long
udf_RGB = RGB(myR, myG, myB)
End Function
Sub CheckColor(myCell As Range, myNameToShape As String, myValueToColor As String)
Dim myShape As Shape
Dim myTargetCell As Range
Dim myColorCode As Long
On Error GoTo Catch
Set myTargetCell = Range(myNameToShape).Columns(1).Find(myCell.Name.Name, LookAt:=xlWhole)
Set myShape = Sheets(1).Shapes(myTargetCell.Offset(0, 1))
GoTo Finally
Catch:
Exit Sub
Finally:
On Error GoTo 0
If myCell.Value < Range(myValueToColor).Cells(2, 1).Value Then
myColorCode = Range(myValueToColor).Cells(1, 2).Value
Else
myColorCode = Application.WorksheetFunction.VLookup(myCell.Value, Range(myValueToColor), 2, True)
End If
myShape.Fill.ForeColor.RGB = myColorCode
End Sub
Sub UpdateMap()
Dim myCell As Range
Application.ScreenUpdating = False
For Each myCell In Range("MapNameToShape").Columns(1).Cells
CheckColor Range(myCell.Value), "MapNameToShape", "MapValueToColor"
Next myCell
Application.ScreenUpdating = True
End Sub
Es wäre hilfreich, wenn Sie den Code als Code formatieren könnten (verwenden Sie die {}). Wäre es nicht einfacher, wenn Sie so etwas mit Gimp oder Photoshop machen würden? –
Hallo. Danke, dass eine Person von Stack das Format für mich korrigiert hat. Ich werde sicher nicht wieder diesen Fehler machen :-) Danke für die Antworten –