Code vereinfachen - Bitte Hilfe
Marc
ich möchte den u.g. Code gerne optimieren. Denn seit dem ich die beiden Variablen "RaZelle3" und "RaZelle4" in die For-Schleife eingefügt habe kommt mein Rechner nicht mehr mit. Also es geht um eine Performance optimierung.
Sub von_raw_nach_cat()
Dim RaZelle1 As Range, bereich1 As Range
Dim RaZelle2 As Range, bereich2 As Range
Dim RaZelle3 As Range, bereich3 As Range
Dim RaZelle4 As Range, bereich4 As Range
Dim LZ1 As String, LZ2 As String, LZ3 As String, LZ4 As String
LZ1 = Workbooks("Raw DATA 062909.XLS").Sheets("tmp8").Range("A1000").End(xlUp).Address( _
RowAbsolute:=False, ColumnAbsolute:=False)
LZ1 = "A2:" + LZ1
LZ2 = Workbooks("Summary 2009Monthly with HEATT June 2009.XLS").Sheets("CAT").Range("A1000"). _
End(xlUp).Address(RowAbsolute:=False, ColumnAbsolute:=False)
LZ2 = "A2:" + LZ2
LZ3 = Workbooks("Raw DATA 062909.XLS").Sheets("tmp8").Range("A1000").End(xlUp).Offset(0, 4). _
Address(RowAbsolute:=False, ColumnAbsolute:=False)
LZ3 = "E2:" + LZ3
LZ4 = Workbooks("Summary 2009Monthly with HEATT June 2009.XLS").Sheets("CAT").Range("A1000"). _
End(xlUp).Offset(0, 2).Address(RowAbsolute:=False, ColumnAbsolute:=False)
LZ4 = "G2:" + LZ4
' Application.ScreenUpdating = False
Set bereich1 = Workbooks("Raw DATA 062909.XLS").Sheets("tmp8").Range(LZ1)
Set bereich3 = Workbooks("Raw DATA 062909.XLS").Sheets("tmp8").Range(LZ3)
Set bereich2 = Workbooks("Summary 2009Monthly with HEATT June 2009.XLS").Sheets("CAT").Range( _
LZ2)
Set bereich4 = Workbooks("Summary 2009Monthly with HEATT June 2009.XLS").Sheets("CAT").Range( _
LZ4)
For Each RaZelle1 In bereich1
For Each RaZelle2 In bereich2
For Each RaZelle3 In bereich3
For Each RaZelle4 In bereich4
If RaZelle1 = RaZelle2 And RaZelle3 = RaZelle4 And status = True Then
RaZelle1.EntireRow.Copy
RaZelle2.EntireRow.PasteSpecial
End If
Next RaZelle4
Next RaZelle3
Next RaZelle2
Next RaZelle1
' Application.ScreenUpdating = True
End Sub
Besten Dank.
Gruß
Marc