Gruppe
Grafik
Problem
Wie kann ich aus einer Tabelle Daten in einem bestimmten Bandreitenbereich separieren und daraus ein Diagramm bilden?
StandardModule: basMain
Sub DiagrammBilden()
Dim cht As Chart
Dim rng As Range
Dim iCounter As Integer, iRow As Integer
Range("A1").CurrentRegion.Sort _
Key1:=Range("A1"), _
Order1:=xlAscending, _
Header:=xlNo, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom
iCounter = 1
For Each rng In Range("A1").CurrentRegion.Columns(2).Cells
If rng.Value > 6.11 And rng.Value < 6.24 Then
Cells(iCounter, 5) = rng.Offset(0, -1).Value
Cells(iCounter, 6) = rng.Value
Cells(iCounter, 7) = rng.Offset(0, 1).Value
iCounter = iCounter + 1
End If
Next rng
iRow = Cells(Rows.Count, 5).End(xlUp).Row
Set cht = Charts.Add
With cht
.ChartType = xlColumnClustered
.SetSourceData _
Source:=Sheets("Tabelle1").Range("E1:G" & iRow), _
PlotBy:=xlColumns
.Location Where:=xlLocationAsObject, Name:="Tabelle1"
End With
End Sub