Sub AAR_updateBudget()
Dim rng1 As Range
Dim rng2 As Range
Dim celle1 As Range
Dim celle2 As Range
Dim colm As Long
With Sheets("AAR_assbudget")
Set rng1 = Range(.Cells(5, "G"), .Cells(.Rows.Count, "G").End(xlUp))
End With
With Sheets("ass_all")
Set rng2 = Range(.Cells(5, "B"), .Cells(204, "B"))
End With
For Each celle1 In rng1
For Each celle2 In rng2
If celle1 = celle2 Then
'_____________
colm = Cells(2, "U").Value * 2 + 21
celle2.Offset(0, colm) = celle1.Offset(0, 3)
'The two above lines takes 6-7 sec.
'_____________
colm = colm + 1
celle2.Offset(0, colm) = celle1.Offset(0, 4)
'The two above lines takes 6-7 sec.
'In total these 4 lines takes 13 sec.
'_____________
End If
Next celle2
Next celle1
' COD_copyformulas Makro
Application.CutCopyMode = False
Range("J107:K107").Copy
Range("J5:K104").PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
|