Supportnet Computer
Planet of Tech

Supportnet / Forum / Tabellenkalkulation

For...next schleife mit step funktion





Frage

HALLO! wie funktionniert eine For ... next schleife? ich habe den folgenden quellcode den ich aufgezeichnet habe um ein diagramm zu erstellen: Sub Macro1() ´ ´ Macro1 Macro ´ Macro recorded 27.06.2006 by nyzar.jorio ´ ´ Charts.Add ActiveChart.ChartType = xlColumnClustered ActiveChart.SetSourceData Source:=Sheets("Charts").Range("J9") ActiveChart.SeriesCollection.NewSeries ActiveChart.SeriesCollection(1).XValues = "=Charts!R10C5:R16C7" ActiveChart.SeriesCollection(1).Values = "=Charts!R10C8:R16C8" ActiveChart.SeriesCollection(1).Name = "=Charts!R8C3" ActiveChart.Location Where:=xlLocationAsObject, Name:="Charts" ActiveChart.HasLegend = False ActiveChart.HasDataTable = True ActiveChart.DataTable.ShowLegendKey = True ActiveSheet.Shapes("Chart 96").IncrementLeft 252.75 ActiveSheet.Shapes("Chart 96").IncrementTop -207# ActiveSheet.Shapes("Chart 96").ScaleWidth 1.07, msoFalse, msoScaleFromTopLeft ActiveSheet.Shapes("Chart 96").ScaleHeight 0.75, msoFalse, msoScaleFromTopLeft With Selection.Border .Weight = 2 .LineStyle = -1 End With With Selection.Interior .ColorIndex = 2 .PatternColorIndex = 1 .Pattern = 1 End With Sheets("Charts").DrawingObjects("Chart 96").RoundedCorners = False Sheets("Charts").DrawingObjects("Chart 96").Shadow = False ActiveChart.PlotArea.Select With Selection.Border .ColorIndex = 16 .Weight = xlThin .LineStyle = xlContinuous End With With Selection.Interior .ColorIndex = 2 .PatternColorIndex = 1 .Pattern = xlSolid End With ActiveChart.ChartArea.Select Selection.AutoScaleFont = True With Selection.Font .Name = "Arial" .FontStyle = "Fett" .Size = 12 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.ChartTitle.Select Selection.AutoScaleFont = True With Selection.Font .Name = "Arial" .FontStyle = "Fett" .Size = 14 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic .Background = xlAutomatic End With ActiveChart.ChartArea.Select End Sub Wie soll ich die for next schleife einbauen, und zwar so dass sich dieser diagramm alle 40 zeilen wiederholt, denn alle 40 zeilen habe ich neue werte.

Antwort 1 von Superarni

Hallo nyzar,

es ist nun 20 Jahre her, dass ich mich damit beschäftigt habe. Meine aber doch zu wissen, wie es geht. Es hat doch nichts damit zu tun, wieviele Zeilen Du wiederholen möchtest.

Früher, damals, war es z.B.

Am Anfang Deiner Schleife.

FOR X = 1 TO Anzahl der Schleifen

am Ende NEXT X

Eleganter geht es doch mit dem WHILE-Befehl.

Hier ist bist Du nicht auf die Anzahl der angegebenen Schleifen begrenzt.

Ich weiß nicht, ob ich richtig liege,
aber ein Versuch!!

Superarni

Ich möchte kostenlos eine Frage an die Mitglieder stellen:


Ähnliche Themen:


Suche in allen vorhandenen Beiträgen: