Dim
startm
As
Integer
Dim
endm
As
Integer
Dim
startf
As
Integer
Dim
endf
As
Integer
Dim
Path
As
String
Public
Function
DiaErstellen()
Dim
chDiagramm
As
ChartObject
If
CBM.Value =
True
Then
If
CoBvonMann.ListIndex = -1
Then
Exit
Function
If
CoBbisMann.ListIndex = -1
Then
Exit
Function
End
If
If
CBF.Value =
True
Then
If
CoBvonFrau.ListIndex = -1
Then
Exit
Function
If
CoBbisFrau.ListIndex = -1
Then
Exit
Function
End
If
Set
chDiagramm = ActiveSheet.ChartObjects.Add(50, 100, 500, 350)
chDiagramm.Chart.ChartType = xlXYScatterLines
chDiagramm.Name =
"Einwohner"
If
CBM.Value =
True
Then
If
CoBvonMann.ListIndex = -1
Then
Exit
Function
With
chDiagramm.Chart.SeriesCollection.NewSeries
.XValues =
"=Tabelle1!A"
+
CStr
(startm) +
":A"
+
CStr
(endm)
.Values =
"=Tabelle1!B"
+
CStr
(startm) +
":B"
+
CStr
(endm)
.Name =
"Männer"
End
With
End
If
If
CBF.Value =
True
Then
Cgetpath_Click
Path = Mid(Path, 1, InStrRev(Path,
"\")) & "
[
" & Mid(Path, InStrRev(Path, "
\
") + 1, Len(Path) - InStrRev(Path, "
\"))
With
chDiagramm.Chart.SeriesCollection.NewSeries
.XValues =
"='"
+ Path +
"]Tabelle1'!A"
+
CStr
(startf) +
":A"
+
CStr
(endf)
.Values =
"='"
+ Path +
"]Tabelle1'!B"
+
CStr
(startf) +
":B"
+
CStr
(endf)
.Name =
"Frauen"
End
With
End
If
Set
chDiagramm =
Nothing
End
Function
Public
Sub
CErstellen_Click()
startm = CoBvonMann.ListIndex + 2
endm = CoBbisMann.ListIndex + 2
startf = CoBvonFrau.ListIndex + 2
endf = CoBbisFrau.ListIndex + 2
DiaErstellen
End
Sub