+ Reply to Thread
Results 1 to 7 of 7

Slow running code

  1. #1
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,163

    Slow running code

    My code runs so slow! The sheet only has 233 rows and 6 of them are not in the loop.
    Any ideas to speed this up is appreciated.

    I know, better programming skills would help.

    Please Login or Register  to view this content.
    Last edited by Rick_Stanich; 11-06-2008 at 12:50 PM.
    Regards

    Rick
    Win10, Office 365

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436
    Use the shcell object rather than it address as the range argument.
    Try all the usual speed-ups.... disable Screenupdating / calculations

    Please Login or Register  to view this content.
    If that does not help a explanation and example data set would help
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,163
    See attached xlsx file.
    Once opened you should see a set of Buttons with in the top 6 rows, the Button labeled "Report 3" is the one that activates the macro.
    In the macro find the sub "CertExpired" which calls "ISOorASexpired" (In the same macro). The macro "ISOorASexpired" is the slow one.

    Macro "ISOorASexpired" reads from the cells in column "O" checking dates that are past due from "Now" (Today). If the date is past due the data in the cell for column "M" is changed to a "Y", if not past due it is changed to a "N", if the cell doesn't meet the criteria in the macro ("n/a", "n/d" or "") then it is left as is.

    I think I am looping once for each condition I examine instead of checking all the conditions while in a single cell (ShCell).
    Attached Files Attached Files

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436
    what's the password?

  5. #5
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,163
    Oops LOL
    2000
    I forgot to remove that

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436
    disabling calculation is all you need to speed it up.

    If you want you could try this code. Double check results are as expected.

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,163
    Oh crap thats fast now!
    p.s.
    I have adopted your clean code

    Thank you Andy.
    :12 pack:

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1