Option
Explicit
Sub
ausdemForum()
ActiveCell.Range(
"A1:A2"
).
Select
Range(Selection, Selection.
End
(xlToRight)).
Select
ActiveSheet.Shapes.AddChart2(251, xlPie).
Select
ActiveChart.SetSourceData Source:=Range(
"Sheet1!$A$30:$F$31"
)
ActiveCell.Offset(2, 0).Range(
"A1:A2"
).
Select
Range(Selection, Selection.
End
(xlToRight)).
Select
End
Sub
Sub
Schleife()
Dim
x
As
Long
Dim
oShp
As
Shape
Dim
c
As
Range
For
Each
oShp
In
Sheets(
"sheet1"
).Shapes
oShp.Delete
Next
oShp
With
Sheets(
"Sheet1"
)
For
x = 2
To
.Cells(2, 1).
End
(xlDown).Row
Step
2
Set
c = .Range(.Cells(x, 1), .Cells(x, 1).
End
(xlToRight).Offset(1))
Set
oShp = .Shapes.AddChart2(251, xlPie)
With
oShp
.Name = c.Cells(1).Text & Format(c.EntireRow.Row,
"00000"
)
.Top = c.Cells(1).Top
.Left = c.Cells(c.Cells.Count).Left + 100
With
.Chart
.SetSourceData Source:=Range(c.Address)
End
With
End
With
Next
x
End
With
End
Sub