Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Anzeige
Inhaltsverzeichnis

Codetempo mangelhaft

Forumthread: Codetempo mangelhaft

Codetempo mangelhaft
18.09.2006 18:36:50
Lorenz
Hallo Excelgemeinde!
Weiss vielleicht jemand eine bessere(schnellere) Lösung, da mit Variante A) mit der Schleife bis zu einer Minute braucht und
mit Variante B) das KopierMakro nur im ersten Blatt ausgeführt wird.
Variante A)

Private Sub CmdStatistik_Click()
Dim i As Integer
For i = 1 To 31
Sheets(i & ".").Select
Call KopierMakro
Next i
End Sub

Variante B)

Private Sub CmdStatistik_Click()
Worksheets(Array("1.", "2.", "3.", "4.", "5.", "6.", "7.", "8.", "9.", "10.", _
"11.", "12.", "13.", "14.", "15.", "16.", "17.", "18.", "19.", "20.", _
"21.", "22.", "23.", "24.", "25.", "26.", "27.", "28.", "29.", "30.", "31.")).Select
Call KopierMakro
End Sub

Sub KopierMakro()
Dim i As Integer, i2 As Integer
If Cells(4, 57).Value > 0 Then _
i = 57
i2 = i + 3
Range(Cells(100, i), Cells(100, i2)).Copy Destination:=Range(Cells(6, i), Cells(89, i2))
If Cells(4, 61).Value > 0 Then _
i = 61
i2 = i + 3
Range(Cells(100, i), Cells(100, i2)).Copy Destination:=Range(Cells(6, i), Cells(89, i2))
If Cells(4, 65).Value > 0 Then _
......
.........
End Sub
Gruss Lorenz
Anzeige

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

Betreff
Datum
Anwender
Anzeige
AW: Codetempo mangelhaft
18.09.2006 18:53:43
EtoPHG
Hallo Lorenz,
Probier's mal mit diesem Zusatz:

Private Sub CmdStatistik_Click()
Dim i, j As Integer
GetMoreSpeed (True)
For i = 1 To 31
Sheets(i & ".").Activate
Call KopierMakro
Next i
GetMoreSpeed (False)
End Sub
Sub GetMoreSpeed(bYesNo As Boolean)
Application.ScreenUpdating = Not (bYesNo)
Application.EnableEvents = Not (bYesNo)
Application.Calculation = IIf(bYesNo, xlCalculationManual, xlCalculationAutomatic)
End Sub

Gruss Hansueli
Anzeige
AW: Codetempo mangelhaft
18.09.2006 19:06:06
Lorenz
Hallo Hansueli!
Habs mit einer nicht so eleganten Lösung, aber folgendermaßen gehabt.
Habe den Code der Textgröße wegen so gepostet.

Sub bbbb()
With Application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlManual
End with
Code......
With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = xlAutomatic
End Sub

Gruß Lorenz
PS: Werde deinen "GetMoreSpeed" ab sofort verwenden, da ich beschriebene Ereignisse sehr oft aus.- bzw einschalten muss.
Anzeige
Anzeige
Anzeige
Live-Forum - Die aktuellen Beiträge
Datum
Titel
14.05.2026 13:31:09
14.05.2026 09:50:42
13.05.2026 19:14:18