Mayhem9266
New Member
- Joined
- Dec 16, 2016
- Messages
- 4
Hello ladies and gentlemen, i need to improve the speed of this macro:
I try to change the loops for If and Mat but I could not do it,
help pls
Code:
Sub qpa()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
ActiveSheet.DisplayPageBreaks = False
Dim iniTime!
iniTime = Timer
Dim rMet, rAni, Contar As Integer
Dim anii, anif, meti, metf As Long
Dim anih, meth As String
Worksheets("metallica").Select
Range("s:s").Clear
rMet = 2
rAni = 2
Contar = 0
Do While Cells(rMet, 1) <> ""
meti = Cells(rMet, 13)
metf = Cells(rMet, 14)
meth = Cells(rMet, 18)
Do While Sheets("antrax").Cells(rAni, 1) <> "" And Contar = 0
anii = Sheets("antrax").Cells(rAni, 4)
anif = Sheets("antrax").Cells(rAni, 5)
anih = Sheets("antrax").Cells(rAni, 7)
If meti >= anii And metf <= anif And meth = anih Then
Sheets("metallica").Cells(rMet, 19) = "x"
Sheets("antrax").Cells(rAni, 8) = "x"
Contar = 1
Else
rAni = rAni + 1
End If
Loop
Contar = 0
rAni = 2
rMet = rMet + 1
Loop
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
ActiveSheet.DisplayPageBreaks = True
Application.CutCopyMode = False
MsgBox "Lo hizo en " & Format(Timer - iniTime, "0.00 seg.")
End Sub
I try to change the loops for If and Mat but I could not do it,
help pls