AW: Diagramm 3D Säulen mit bedingter Formatierung
06.11.2019 16:07:40
Kevin
Hallo Daniel,
Schade. Aber mit diesem VBA-Code habe ich das dann hinbekommen.
Die VBA-Könner unter euch schlagen sich jetzt wahrscheinlich die Hände übern Kopf zusammen und würden gerne die Hälfte des Codes rausstreichen oder umschreiben. Aber ich als VBA-Laie bin schon sehr stolz, dass es überhaupt so funktioniert wie es soll.
Hier auch nochmal die funktionierende Datei:
https://www.herber.de/bbs/user/132980.xlsm
Sub Diagrammformatierung()
Dim a As Long
Dim b As Long
Dim c As Long
Dim d As Long
a = 1
b = 1
For a = 1 To 3 Step 1
ActiveSheet.ChartObjects("Diagramm 1").Activate
ActiveChart.SeriesCollection(a).Select
For b = 1 To 15 Step 1
c = a + 1
d = b + 5
If Cells(d, c) > Cells(4, 2) Then
ActiveChart.SeriesCollection(a).Points(b).Select
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
'.Transparancy = 0
.Solid
End With
Else
If Cells(d, c) > Cells(4, 4) Then
ActiveChart.SeriesCollection(a).Points(b).Select
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 255, 0)
'.Transparancy = 0
.Solid
End With
Else
ActiveChart.SeriesCollection(a).Points(b).Select
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 112, 192)
'.Transparancy = 0
.Solid
End With
End If
End If
Next b
Next a
Range("F19").Select
End Sub
Viele Grüße,
Kevin