+ Reply to Thread
Results 1 to 8 of 8

Do While Loop taking too long

  1. #1
    Registered User
    Join Date
    05-31-2017
    Location
    Brunswick, ME
    MS-Off Ver
    2013 (work) and 365 (home)
    Posts
    70

    Do While Loop taking too long

    I'm trying to write a code to update a cell value based on its current text and the beginning character of the adjacent cell. I've written the below code, but the sheet is roughly 77,000 lines, and it is taking forever to run (the attached is about 40k lines).

    Can someone help me update/ simplify this so that it runs smoothly and quickly?

    Please Login or Register  to view this content.
    Attached Files Attached Files

  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: Do While Loop taking too long

    The first thing you could try is not activating/selecting.
    Please Login or Register  to view this content.
    If that doesn't speed things up sufficiently you could try using an array.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Do While Loop taking too long

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,072

    Re: Do While Loop taking too long

    Another option
    Please Login or Register  to view this content.
    Although this will convert the numbers to proper numbers rather than text

  5. #5
    Registered User
    Join Date
    05-31-2017
    Location
    Brunswick, ME
    MS-Off Ver
    2013 (work) and 365 (home)
    Posts
    70

    Re: Do While Loop taking too long

    Thank you all.

    Norie and Mumps1,
    The array solutions work great! However, I've hit a snag.
    In my actual spreadsheet, the data are in D:E, not A:B. I was thinking I could take the code and change the cell reference, but that's not working.
    I'm guessing it has something to do with the bounded variables, but I am unsure.

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Do While Loop taking too long

    Try:
    Please Login or Register  to view this content.

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

    Re: Do While Loop taking too long

    Try this.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    05-31-2017
    Location
    Brunswick, ME
    MS-Off Ver
    2013 (work) and 365 (home)
    Posts
    70

    Re: Do While Loop taking too long

    Norie and Mumps1,

    Again, thank you both! Both solutions get me what I want.

+ 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] For Each loop taking long to run
    By Jay S. in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-07-2018, 01:08 PM
  2. When Refresh All is taking too long....
    By dd510 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-28-2014, 12:29 PM
  3. taking too long to load2
    By muhdass in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2013, 05:22 AM
  4. taking too long to load
    By muhdass in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-18-2013, 11:54 PM
  5. Is there anyway to see why ScreenUpdating is taking so long?
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-11-2011, 04:17 AM
  6. [SOLVED] Excel taking too long to open up
    By dkblee in forum Excel General
    Replies: 1
    Last Post: 03-26-2006, 06:35 AM
  7. [SOLVED] Cell Calculation taking to long
    By Emma in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-26-2005, 07:06 PM

Tags for this Thread

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