ThrottleWorks
Excel Ninja
Hi,
I am running below mentioned loop in my code.
The loop takes around 1-2 minutes to run. Speed depends on the system speed of that particular time.
Is there better option to reduce the time required or can the below mentioned code be better.
Please help. I will try to explain what the code does below. Sorry for not uploading sample file.
The range Rng5 is in Sheet1.
From Sheet 1 I have defined non - blank cells of Column A as Rng5.
The loop runs for each non blank value from Column A.
Each value from the range is searched in Sheet 2.
Once macro finds the value it copies Offset(0, -6).value from the active cell of Sheet 2 and paste it in Sheet 1.
Prior to running the macro Sheet 2 is active where records are to be searched.
Once again sorry for not uploading file.
PS - The macro took 1 minute for searching 25 records.
I am running below mentioned loop in my code.
The loop takes around 1-2 minutes to run. Speed depends on the system speed of that particular time.
Is there better option to reduce the time required or can the below mentioned code be better.
Please help. I will try to explain what the code does below. Sorry for not uploading sample file.
The range Rng5 is in Sheet1.
From Sheet 1 I have defined non - blank cells of Column A as Rng5.
The loop runs for each non blank value from Column A.
Each value from the range is searched in Sheet 2.
Once macro finds the value it copies Offset(0, -6).value from the active cell of Sheet 2 and paste it in Sheet 1.
Prior to running the macro Sheet 2 is active where records are to be searched.
Once again sorry for not uploading file.
PS - The macro took 1 minute for searching 25 records.
Code:
For Each rn In Rng5
Range("A1").Select
Cells.Find(what:=rn, After:=ActiveCell, LookIn:= _
xlFormulas, lookat:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(0, -6).Copy Destination:=rn.Offset(0, 6)
Next rn
Last edited: