I have this Excel VB code, and everytime after it executes this line, it pauses for half a second:
Worksheets(ws.Name).Range("A" & i & ":G" & i).Copy _
Destination:=Worksheets("Sheet1").Range("A" & emptyCell)
Can someone tell me what it is doing, and how I can prevent it from taking so long?
I have Microsoft Excel 2007 on Windows XP Pro
Update: If I paste it by hand, it waits about the same amount of time.
It all depends on the specs of the hardware (hard drive, memory, network connection, ect). If its running on a network, that will be the biggest bottleneck. There is nothing inherently wrong with the code.
You can also try speeding up the routine by turning the workbooks calculation to manual, and turning off screen updating. If the calculation is automatic it will calculate on every copy call.