Reduce run time of macro

  • Hi Team,

    I've this below piece of code which extracts email details for any specific date or all the dates from a specific folder and puts in excel, which runs perfectly fine.

    But the problem is I have more than 1 lac+ emails in the folder, and when I run the macro for any specific date it takes way to long to run.

    I know since the emails are in huge numbers it would be slow, but can any one suggest some way which can reduce the run time?


  • For starters, I would add at the beginning


    Code
    Application.ScreenUpdating = False


    and before End Sub


    Code
    Application.ScreenUpdating = True

    additionally, you may wish to turn automatic calculations off

  • Maybe something like this but you may want to add the filter by date. I was not sure what you wanted with that. I removed some things so I could work up this example.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!