Here in my xlsm file I'm finding that when I run my macro, it(macro) take too long to fill up just 3600 cells. If anyone can help improve and increase the execution speed of my macro I'll be happy beyond the borders and boundaries. Thanks in advance(All vba code are available in file itself)
Dim TimeToRun
Sub auto_open()
Application.ScreenUpdating = False
Call ScheduleTrackingOn
End Sub
Sub ScheduleTrackingOn()
Application.ScreenUpdating = False
TimeToRun = Now + TimeValue("00:00:01")
Application.OnTime TimeToRun, "TrackingOn"
Application.ScreenUpdating = True
End Sub
Sub TrackingOn()
Application.ScreenUpdating = False
Dim k As Integer
For k = 6 To 155
If Cells(k, 2).Value <> Cells(k, 28).Value Then
Cells(k, 28).Value = Cells(k, 2).Value
Else
End If
Next
Dim l As Integer
For l = 6 To 155
If Cells(l, 3).Value <> Cells(l, 29).Value Then
Cells(l, 29).Value = Cells(l, 3).Value
Else
End If
Next
Dim m As Integer
For m = 6 To 155
If Cells(m, 4).Value <> Cells(m, 30).Value Then
Cells(m, 30).Value = Cells(m, 4).Value
Else
End If
Next
Dim n As Integer
For n = 6 To 155
If Cells(n, 5).Value <> Cells(n, 31).Value Then
Cells(n, 31).Value = Cells(n, 5).Value
Else
End If
Next
Dim o As Integer
For o = 6 To 155
If Cells(o, 6).Value <> Cells(o, 32).Value Then
Cells(o, 32).Value = Cells(o, 6).Value
Else
End If
Next
Dim p As Long
For p = 6 To 155
If Cells(p, 7).Value <> Cells(p, 33).Value Then
Cells(p, 33).Value = Cells(p, 7).Value
Else
End If
Next
Dim q As Integer
For q = 6 To 155
If Cells(q, 8).Value <> Cells(q, 34).Value Then
Cells(q, 34).Value = Cells(q, 8).Value
Else
End If
Next
Dim r As Integer
For r = 6 To 155
If Cells(r, 9).Value <> Cells(r, 35).Value Then
Cells(r, 35).Value = Cells(r, 9).Value
Else
End If
Next
Dim s As Integer
For s = 6 To 155
If Cells(s, 10).Value <> Cells(s, 36).Value Then
Cells(s, 36).Value = Cells(s, 10).Value
Else
End If
Next
Dim t As Integer
For t = 6 To 155
If Cells(t, 11).Value <> Cells(t, 37).Value Then
Cells(t, 37).Value = Cells(t, 11).Value
Else
End If
Next
Dim u As Integer
For u = 6 To 155
If Cells(u, 12).Value <> Cells(u, 38).Value Then
Cells(u, 38).Value = Cells(u, 12).Value
Else
End If
Next
Dim w As Integer
For w = 6 To 155
If Cells(w, 13).Value <> Cells(w, 39).Value Then
Cells(w, 39).Value = Cells(w, 13).Value
Else
End If
Next
Dim x As Integer
For x = 6 To 155
If Cells(x, 14).Value <> Cells(x, 40).Value Then
Cells(x, 40).Value = Cells(x, 14).Value
Else
End If
Next
Dim y As Integer
For y = 6 To 155
If Cells(y, 15).Value <> Cells(y, 41).Value Then
Cells(y, 41).Value = Cells(y, 15).Value
Else
End If
Next
Dim z As Integer
For z = 6 To 155
If Cells(z, 16).Value <> Cells(z, 42).Value Then
Cells(z, 42).Value = Cells(z, 16).Value
Else
End If
Next
Dim a As Integer
For a = 6 To 155
If Cells(a, 17).Value <> Cells(a, 43).Value Then
Cells(a, 43).Value = Cells(a, 17).Value
Else
End If
Next
Dim b As Integer
For b = 6 To 155
If Cells(b, 18).Value <> Cells(b, 44).Value Then
Cells(b, 44).Value = Cells(b, 18).Value
Else
End If
Next
Dim c As Integer
For c = 6 To 155
If Cells(c, 19).Value <> Cells(c, 45).Value Then
Cells(c, 45).Value = Cells(c, 19).Value
Else
End If
Next
Dim d As Integer
For d = 6 To 155
If Cells(d, 20).Value <> Cells(d, 46).Value Then
Cells(d, 46).Value = Cells(d, 20).Value
Else
End If
Next
Dim e As Integer
For e = 6 To 155
If Cells(e, 21).Value <> Cells(e, 47).Value Then
Cells(e, 47).Value = Cells(e, 21).Value
Else
End If
Next
Dim f As Integer
For f = 6 To 155
If Cells(f, 22).Value <> Cells(f, 48).Value Then
Cells(f, 48).Value = Cells(f, 22).Value
Else
End If
Next
Dim g As Integer
For g = 6 To 155
If Cells(g, 23).Value <> Cells(g, 49).Value Then
Cells(g, 49).Value = Cells(g, 23).Value
Else
End If
Next
Dim h As Integer
For h = 6 To 155
If Cells(h, 24).Value <> Cells(h, 50).Value Then
Cells(h, 50).Value = Cells(h, 24).Value
Else
End If
Next
Dim i As Integer
For i = 6 To 155
If Cells(i, 25).Value <> Cells(i, 51).Value Then
Cells(i, 51).Value = Cells(i, 25).Value
Else
End If
Next
Call ScheduleTrackingOn
Application.ScreenUpdating = True
End Sub
Sub auto_close()
On Error Resume Next
Application.OnTime TimeToRun, "TrackingOn", , False
End Sub