Re: how to reduce execution time of my code?
- From: "Bob Phillips" <bob.NGs@xxxxxxxxxxxxx>
- Date: Thu, 9 Aug 2007 14:50:33 +0100
This might be quicker
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
With wbSource.Worksheets("Flowdate")
For j = 24 To 36 Step 4
row_price = 2315
For i = 0 To 364
peak_price = .Cells(row_price, j).Value
If peak_price = "" Then
.Cells(row_price, j).Value = _
.Cells(row_price, j).Offset(0, 2).Value
End If
offpeak_price = .Cells(row_price, j + 1).Value
If offpeak_price = "" Then
.Cells(row_price, j + 1).Value = _
.Cells(row_price, j + 1).Offset(0, 2).Value
End If
row_price = row_price + 1
Next
MsgBox "Calculation done"
Next
End With
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
--
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
<catchchatur@xxxxxxxxx> wrote in message
news:1186666696.788754.284460@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Experts,
I am running my macro and its taking almost 5 minutes during execution
on my computer (2GB RAM). Is there any way by which I can reduce this
execution time? Here is the code...
With wbSource.Worksheets("Flowdate")
For j = 24 To 36 Step 4
row_price = 2315
For i = 0 To 364
peak_price = .Cells(row_price, j).Value
If peak_price = "" Then
Worksheets("Flowdate").Cells(row_price, j).Value =
Worksheets("Flowdate").Cells(row_price, j).Offset(0, 2).Value
End If
offpeak_price = .Cells(row_price, j + 1).Value
If offpeak_price = "" Then
Worksheets("Flowdate").Cells(row_price, j + 1).Value =
Worksheets("Flowdate").Cells(row_price, j + 1).Offset(0, 2).Value
End If
row_price = row_price + 1
Next
MsgBox "Calculation done"
Next
End With
.
- Follow-Ups:
- Re: how to reduce execution time of my code?
- From: catchchatur@xxxxxxxxx
- Re: how to reduce execution time of my code?
- References:
- how to reduce execution time of my code?
- From: catchchatur@xxxxxxxxx
- how to reduce execution time of my code?
- Prev by Date: RE: Macro question.
- Next by Date: RE: Macro question.
- Previous by thread: how to reduce execution time of my code?
- Next by thread: Re: how to reduce execution time of my code?
- Index(es):
Relevant Pages
|