AW: VBA: Tab.blätter während VBA-Prozess stilllegen?
22.08.2015 22:04:01
Joerschi
Dank Dir Nepumuk,
da ich ein absoluter Anfänger in VBA bin, nochmal als Nachfrage:
So sieht aktuell mein Code aus
(der Prozess läuft mir auch zu langsam und vielleicht kann man den optimieren, aber die Nachfrage ich wohl ein anderes Mal als Thread eröffnen):
Sub Test123_1()
Application.ScreenUpdating = False
With Sheets("aktWo_Wahl")
For i = .Cells(11, 276) To .Cells(11, 277)
.Cells(12, 276) = i
.Range("aid1:aih3000").Copy
With Sheets("xyz")
.Cells(2, Columns.Count).End(xlToLeft) _
.Offset(-1, IIf(.Range("a1") = "", 0, 6)).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End With
Next i
End With
Application.Goto Sheets("xyz").Range("A1"), True
End Sub
In Deinen Vorschlag eingebunden wäre dies dann so:
Public Sub Beispiel()
Dim avntArray As Variant, iavntItem As Variant
avntArray = Array("Tabelle1", "Tabelle2", "Tabelle3")
For Each iavntItem In avntArray
Worksheets(iavntItem).EnableCalculation = False
Next
Sub Test123_1()
Application.ScreenUpdating = False
With Sheets("aktWo_Wahl")
For i = .Cells(11, 276) To .Cells(11, 277)
.Cells(12, 276) = i
.Range("aid1:aih3000").Copy
With Sheets("xyz")
.Cells(2, Columns.Count).End(xlToLeft) _
.Offset(-1, IIf(.Range("a1") = "", 0, 6)).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End With
Next i
End With
Application.Goto Sheets("xyz").Range("A1"), True
End Sub
For Each iavntItem In avntArray
Worksheets(iavntItem).EnableCalculation = True
Next
End Sub
Richtig?
Danke vorab und liebe Grüße
Joerschi