Live-Forum - Die aktuellen Beiträge
Datum
Titel
28.03.2024 21:12:36
28.03.2024 18:31:49
Anzeige
Archiv - Navigation
928to932
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
928to932
928to932
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Code optimieren

Code optimieren
29.11.2007 14:50:33
Jakob
Hallo,
ich habe folgenden Code mit den Makrorekorder aufgezeichnet. Er ist aber etwas langsam. Wie könnte man ihn optimieren und ihn zu beschleunigen.

Sub Land12M()
ActiveChart.PivotLayout.PivotTable.PivotFields("Jahr").CurrentPage = "(Alle)"
ActiveChart.PivotLayout.PivotTable.PivotFields("12 Monate Rol.").CurrentPage = _
"R"
ActiveChart.PivotLayout.PivotTable.PivotFields("Jahressicht").CurrentPage = _
"(Alle)"
ActiveChart.PivotLayout.PivotTable.PivotFields("Na MG").CurrentPage = _
"(Alle)"
With ActiveChart.PivotLayout.PivotTable.PivotFields("Land")
.Orientation = xlRowField
.Position = 1
End With
With ActiveChart.PivotLayout.PivotTable.PivotFields("CL")
.Orientation = xlRowField
.Position = 1
End With
End Sub


Vielen Dank im Voraus für Eure Hilfe.
Gruß,
Jakob

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Code optimieren
29.11.2007 15:41:12
Erich
Hallo Jakob,
dass das hier sehr viel schneller läuft, glaube ich nicht:

Sub Land12M()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
With ActiveChart.PivotLayout.PivotTable
.PivotFields("Jahr").CurrentPage = "(Alle)"
.PivotFields("12 Monate Rol.").CurrentPage = "R"
.PivotFields("Jahressicht").CurrentPage = "(Alle)"
.PivotFields("Na MG").CurrentPage = "(Alle)"
With .PivotFields("Land")
.Orientation = xlRowField
.Position = 1
End With
With .PivotFields("CL")
.Orientation = xlRowField
.Position = 1
End With
End With
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort

Anzeige
AW: Code optimieren
29.11.2007 17:05:45
Jakob
Hallo Erich,
es hat super geklappt. Das Makro läuft jetzt viel schneller.
Vielen Dank.
Gruß,
Jakob

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige