+ Reply to Thread
Results 1 to 12 of 12

Speed up a macro...

  1. #1
    Forum Contributor
    Join Date
    10-27-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    136

    Speed up a macro...

    Hi all,

    So below is the code i use to convert column B from yyyymmdd to mm/dd/yyyy:

    Please Login or Register  to view this content.
    I have to do this for 6000 lines and this is taking way to long. I have "Application.ScreenUpdating = False" at the start is there anything else i can do to speed it up?

    Thank you

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Speed up a macro...

    Select the column, goto Data>Text to columns..., on the 3rd step select YMD from the column data fomat dropdown and click Finish.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    10-27-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Speed up a macro...

    You mean doing this manually?

  4. #4
    Forum Contributor
    Join Date
    10-27-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Speed up a macro...

    I have no problem doing this my self.... the problem is this is a big macro and process that i am streamlining. the code above is just one very small part of the macro. but it is the one that takes time.

  5. #5
    Forum Contributor
    Join Date
    05-29-2013
    Location
    MD
    MS-Off Ver
    Excel 365
    Posts
    148

    Re: Speed up a macro...

    How long is it taking you currently?

    It doesn't seem like it should take a long time.

  6. #6
    Registered User
    Join Date
    12-04-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Speed up a macro...

    You can always record the process that Norie posted and incorporate that into your macro. And I've found looping through ranges using the collection is slower than using a numeric variable to step through row numbers.

  7. #7
    Forum Contributor
    Join Date
    10-27-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Speed up a macro...

    10 to 15 min.

    So my other question is there a way i could filter column B with the date as it is yyyymmdd vs. changing the column then using:
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    10-27-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Speed up a macro...

    Larai.... you talking way over my head.... Not a very good writer.

  9. #9
    Registered User
    Join Date
    12-04-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Speed up a macro...

    Why not perform your date calculation, change the calculated date to yyyymmdd and set your filter accordingly?
    strFilter = format(date()-180,"yyyymmdd")
    Criteria1:="<=" & strFilter

    You might have to tweak a bit, I haven't tested it.

  10. #10
    Forum Contributor
    Join Date
    10-27-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Speed up a macro...

    i'll give that i try... again...

  11. #11
    Forum Contributor
    Join Date
    10-27-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Speed up a macro...

    Seams like that worked fine.. will need to run this live a few times... but Thank you Larai!!

  12. #12
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Speed up a macro...

    Here is the VBA version for text to columns to convert a number stored as yyyymmdd to a date of mm/dd/yyyy:
    Please Login or Register  to view this content.

    The code completed basically instantly for me on a test set of 10,000 rows.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How To Speed up macro
    By AnkitGuru in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-02-2012, 06:36 AM
  2. Speed Up Macro
    By jbmerrel in forum Excel General
    Replies: 4
    Last Post: 01-16-2012, 01:40 PM
  3. speed up macro
    By ilkamalo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2010, 09:16 AM
  4. Help, need to speed up this macro
    By retseort in forum Excel General
    Replies: 3
    Last Post: 01-12-2006, 08:35 AM
  5. [SOLVED] Macro Speed
    By Don Lloyd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-28-2005, 02:06 PM

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