macro takes too long

kylefoley76

Well-known Member
Joined
Mar 1, 2010
Messages
1,553
This macro is taking about 1 second to loop through just 1 iteration and it is a very simple macro. With about 700 interations it will take more than 11 minutes.

What is wrong?

Code:
Sub dates()


Dim thedate As Date


thedate = ActiveCell.Offset(-1).Value
Dim i As Integer
Application.ScreenUpdating = False




Do Until ActiveCell.Offset(0, 1) = ""
i = i + 1




    If ActiveCell.Offset(0, 2).Value <> "x" Then
    ActiveCell = thedate
    Else
    thedate = thedate + 1
    ActiveCell = thedate
    End If
ActiveCell.Offset(1).Select




Loop


Application.ScreenUpdating = True


End Sub
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
post 22 refers to post 19, I forgot to quote it. As always thanks for taking an interest in my thread, but then again on your webpage it says that you don't like one-liners that express gratitude, is that true?
 
Upvote 0
post 22 refers to post 19, I forgot to quote it.
I don't understand how your comment in Message #22 applies to my request that you time test the code I posted in Message #19?



..but then again on your webpage it says that you don't like one-liners that express gratitude, is that true?
:confused: Where does it say that at?
 
Upvote 0

Forum statistics

Threads
1,215,248
Messages
6,123,869
Members
449,130
Latest member
lolasmith

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top