AW: Dynamisches Diagramm
08.03.2017 15:50:44
Beverly
Hi Yilmaz,
das ist aber eine andere Fragestellung als in deinem Eröffnungsbeitrag.
Schreibe in AH13 "Alle" und weise der ComboBox in "Calculation" als ListFillrange $AH$1:$AH$13 und der ComboBox in "Diag.1" als ListFillRange Calculation!$AH$1:$AH$13 zu. Den definierten Namen kannst du löschen.
Unter DieseArbeitsmappe:
Option Explicit
Private Sub Workbook_Open()
Sheets("Calculation").ComboBox1.ListIndex = 12
End Sub
Unter Tabelle "Calculation":
Option Explicit
Private Sub ComboBox1_Change()
Dim m, Y, d1, d2, rng As Range
If iStrg = 1 Then GoTo ende
With Sheets("Calculation")
If ComboBox1.ListIndex = 12 Then
Application.EnableEvents = False
iStrg = 1
If .AutoFilterMode Then .Range("B9").CurrentRegion.AutoFilter field:=2
iStrg = 0
Else
m = Sheets("Calculation").ComboBox1.ListIndex + 1
Y = Year(Sheets("Calculation").Cells(10, 2))
d1 = DateSerial(Y, m, 1)
d2 = DateSerial(Year(d1), Month(d1) + 1, Day(d1)) - 1
Application.EnableEvents = False
iStrg = 1
Set rng = Range(.Cells(10, 2), .Cells(5000, 27))
rng.AutoFilter field:=2, Criteria1:=">=" & CDbl(d1), Operator:=xlAnd, Criteria2:="
Unter Tabelle "Diag.1":
Option Explicit
Private Sub ComboBox1_Change()
If iStrg = 1 Then Exit Sub
With Sheets("Calculation")
.ComboBox1.Value = .Range("AH1:AH13").Cells(ActiveSheet.ComboBox1.ListIndex + 1)
End With
End Sub