Private
Sub
UserForm_Initialize()
Dim
i
As
Single
For
i = 1
To
Worksheets.Count
With
ListBox1
.AddItem Worksheets(i).Name
End
With
Next
i
End
Sub
Private
Sub
CommandButton1_Click()
Dim
i
As
Long
ActiveChart.Location Where:=xlLocationAsNewSheet
ActiveChart.ChartArea.
Select
ActiveChart.PlotArea.
Select
For
i = 0
To
ListBox1.ListCount - 1
If
ListBox1.Selected(i)
Then
With
ActiveChart.FullSeriesCollection
.Name = Worksheets(i).Name
.Values = Worksheets(i).Range(
"C23"
).
End
(xlDown).Row
.XValues = Worksheets(i).Range(
"B23"
).
End
(xlDown).Row
End
With
End
If
Next
i
ActiveChart.SetElement (msoElementLegendBottom)
ActiveChart.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
ActiveChart.SetElement (msoElementPrimaryValueAxisTitleAdjacentToAxis)
ActiveChart.SetElement (msoElementPrimaryCategoryGridLinesMajor)
ActiveChart.SetElement (msoElementPrimaryCategoryGridLinesNone)
ActiveChart.Axes(xlCategory).
Select
ActiveChart.Axes(xlCategory).
Select
ActiveChart.Axes(xlCategory).CategoryType = xlTimeScale
ActiveChart.Axes(xlCategory).CategoryType = xlAutomatic
Selection.MajorTickMark = xlOutside
ActiveChart.Axes(xlCategory).TickLabelSpacingIsAuto =
True
ActiveChart.Axes(xlCategory).TickMarkSpacing = 600
ActiveChart.SetElement (msoElementPrimaryCategoryGridLinesMajor)
If
TextBox1.Text =
""
Then
MsgBox (
"Bitte einen Diagrammnamen vergeben"
)
End
If
ActiveSheet.Name = TextBox1.Text
End
Sub