Hi There,
I've got this macro which copies the values in cells A4:F4 to H4:M4, then repeats N times, with the number of loops being set by the variable EJECT.
The trouble is, even with ScreenUpdating set to False, it takes about 15 minutes on my PC to do 30,000 loops (the average number of runs I require), and the maximum of about 60,000 runs takes a 'Forget-About-It' 45 minutes!
I expect I need to do somthing about all that Selecting, but I'd appreciate any streamlining tips!
Note to the Forum Police - I've also posted this on VBA 5&6 - Sorry!![[blush] [blush] [blush]](/data/assets/smilies/blush.gif)
Chris
Varium et mutabile semper Excel
I've got this macro which copies the values in cells A4:F4 to H4:M4, then repeats N times, with the number of loops being set by the variable EJECT.
Code:
Public Sub DataLogger()
Num_Of_Fails = 0
Num_Of_Runs = 0
System_Reliability = 1
[F4] = 1
EJECT = [G1].Value
Application.ScreenUpdating = False
For N = 1 To EJECT
Calculate
[G4] = N
If [E4] = 0 Then
Num_Of_Fails = Num_Of_Fails + 1
System_Reliability = 1 - (Num_Of_Fails / N)
[F4] = System_Reliability
[G5] = Num_Of_Fails
End If
[A4:F4].Select
Selection.Copy
ActiveCell(N, 8).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Next N
Application.ScreenUpdating = True
End Sub
I expect I need to do somthing about all that Selecting, but I'd appreciate any streamlining tips!
Note to the Forum Police - I've also posted this on VBA 5&6 - Sorry!
![[blush] [blush] [blush]](/data/assets/smilies/blush.gif)
Chris
Varium et mutabile semper Excel