+ Reply to Thread
Results 1 to 9 of 9

Creating a Progress Bar

  1. #1
    Registered User
    Join Date
    05-13-2019
    Location
    Louisiana
    MS-Off Ver
    2016
    Posts
    76

    Creating a Progress Bar

    I have a macro that takes a while to run and I would like to have a progress bar that pops up and shows what percentage is complete. I have created a user form and some code from what I was able to come up with by doing some research online but I cant get it to work. I believe it has to do with some of the variables in this code are already used in other ways in my macro and possibly I am putting it in the wrong location. I have tried many different ways and I am at a loss. Any help would be greatly appreciated.

    I have attached my spreadsheet.

    Here is the main code that I am trying to insert the progress bar into:

    Please Login or Register  to view this content.

    I have been placing this code before "With ThisWorkbook" in the main code.

    Please Login or Register  to view this content.
    And I have been placing this after "next i" in the main code

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

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Creating a Progress Bar

    A little more of a roadmap to your code would help. You have a couple of places with very similar code to the excerpt you provided. I believe this is from the sub CreateWorkbook.MergeandFillHeader.

    Would also help to tell us specifically what "I cant get it to work" means.

    Also helpful to tell us how to run your macro.

    The code you said you are trying does not appear in the file. However, it seems that the problem is that you have a For loop that iterates using i, and then inside that you have a For loop that iterates using i. Not a good practice. I find your code confusing in that your existing code is looping through the array v, but the code you showed (and aren't using) loops through rows.

    Anyway, here is the best guess I can take at this. Also note that Progress must be modeless. I cannot run your code because it opens other workbooks that I do not have. I attached the modified file. I marked my changes here:

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Creating a Progress Bar

    If you don't want to use a form, you can represent progress graphically in the statusbar.

    In a module
    Please Login or Register  to view this content.
    usage
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    05-13-2019
    Location
    Louisiana
    MS-Off Ver
    2016
    Posts
    76

    Re: Creating a Progress Bar

    This worked perfectly. Thanks so much

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Creating a Progress Bar

    Quote Originally Posted by allenayres83 View Post
    This worked perfectly. Thanks so much
    Which one?

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking addreputationiconsmall.jpg below their name.

  6. #6
    Registered User
    Join Date
    05-13-2019
    Location
    Louisiana
    MS-Off Ver
    2016
    Posts
    76

    Re: Creating a Progress Bar

    This is the code that worked. I thought I quoted this before but guess I messed that up.

    Quote Originally Posted by 6StringJazzer View Post
    Anyway, here is the best guess I can take at this.
    Last edited by 6StringJazzer; 09-26-2023 at 02:12 PM. Reason: There is no need to quote the entire post

  7. #7
    Registered User
    Join Date
    05-13-2019
    Location
    Louisiana
    MS-Off Ver
    2016
    Posts
    76

    Re: Creating a Progress Bar

    Is there a way to add a progress bar to a web query macro? I have a macro that copies and paste a table from a web source and it can take a while sometimes. It would be nice to have a progress bar for that also.

    I made a simple user form that just says "retrieving data" and this would be fine too if i could get it working but it pops up as just a blank white window unless I force the macro to wait.

    Please Login or Register  to view this content.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Creating a Progress Bar

    You can't do a progress bar for that because to VBA a web query is an atomic operation. (Your other situation had a loop so you could update the progress every time through the loop.)

    I don't know why your form is showing up white. I once had a similar issue and forced it to repaint. I don't know if that will work for you. Try putting this line right after the Show line:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-13-2019
    Location
    Louisiana
    MS-Off Ver
    2016
    Posts
    76

    Re: Creating a Progress Bar

    This worked for me. Thanks so much
    Last edited by 6StringJazzer; 09-26-2023 at 03:13 PM. Reason: There is no need to quote the entire post

+ 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] Creating a Working Progress Sheet with Workday Functions
    By nathandavies in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-17-2014, 03:34 AM
  2. Creating a YTD total for budget that changes as the months progress
    By abbacus in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-01-2013, 06:44 AM
  3. Creating a progress chart
    By kenhjh in forum Excel General
    Replies: 2
    Last Post: 07-11-2010, 10:27 PM
  4. Problem creating a progress bar
    By nicola777 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-28-2008, 10:03 AM
  5. Creating a progress bar
    By dscott in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-09-2007, 03:24 AM
  6. Creating a progress bar in VB
    By Ultranoob in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-05-2007, 06:20 PM
  7. [SOLVED] Creating a generic progress bar
    By SJC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2005, 10:15 AM

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