+ Reply to Thread
Results 1 to 21 of 21

adding a progress bar to vba code

  1. #1
    Forum Contributor
    Join Date
    05-09-2009
    Location
    Chicago, US
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    188

    adding a progress bar to vba code

    Hi all, how would I add a nice progress bar to the following code:

    Please Login or Register  to view this content.
    I've been reading all over the internet and there is a ProgressBar control v6, which I added, and I drew that in a User.Form3 ...but I don't know how to get it to move or load?

    Please help.

  2. #2
    Forum Contributor
    Join Date
    05-09-2009
    Location
    Chicago, US
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    188

    Re: adding a progress bar to vba code

    I would want the progressbar to show the progress of the Loop, or I could maybe add a counter within the loop, and show a progress of that.

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: adding a progress bar to vba code

    try using
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  4. #4
    Forum Contributor
    Join Date
    05-09-2009
    Location
    Chicago, US
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    188

    Re: adding a progress bar to vba code

    Where do I put that code? After what? I did it just before, "Next i" and it gives me the following error:

    Run-time error '424' .. Object Required

  5. #5
    Forum Contributor
    Join Date
    05-09-2009
    Location
    Chicago, US
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    188

    Re: adding a progress bar to vba code

    And the UserForm does not show at all. It just gives me that error.

  6. #6
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: adding a progress bar to vba code

    Entia non sunt multiplicanda sine necessitate

  7. #7
    Forum Contributor
    Join Date
    05-09-2009
    Location
    Chicago, US
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    188

    Re: adding a progress bar to vba code

    wow, that is awesome stuff!! the first and most simple bar is the one i am looking for...how would i incorporate into my loop!? i dont think i get it from his code.

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: adding a progress bar to vba code

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    05-09-2009
    Location
    Chicago, US
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    188

    Re: adding a progress bar to vba code

    okay let me try that!

  10. #10
    Forum Contributor
    Join Date
    05-09-2009
    Location
    Chicago, US
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    188

    Re: adding a progress bar to vba code

    when i run it, it tells me that

    .ProgressBar1.Value = i
    has "invalid property value"

  11. #11
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: adding a progress bar to vba code

    I think the userform has to have the change "modalshow = false"

  12. #12
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: adding a progress bar to vba code

    Do you have a userform and a progressbar?

  13. #13
    Forum Contributor
    Join Date
    05-09-2009
    Location
    Chicago, US
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    188

    Re: adding a progress bar to vba code

    still getting the same error. one would think progress bar shouldn't be so complicated as all it has to do is count the loop and display the percentage done within a loop

  14. #14
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: adding a progress bar to vba code

    Its not , change the userform and progress bars to what your names are

  15. #15
    Forum Contributor
    Join Date
    05-09-2009
    Location
    Chicago, US
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    188

    Re: adding a progress bar to vba code

    Yes, my UserForm is UserForm3. And the progressbar is ProgressBar1. Here is the full code:

    Please Login or Register  to view this content.
    Last edited by losmi8; 02-21-2010 at 01:39 AM.

  16. #16
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: adding a progress bar to vba code

    Dude with the userform property " ShowModal = true"

    Try..
    Please Login or Register  to view this content.
    if that doesnt work zip and attach the workbook and I have a look

  17. #17
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: adding a progress bar to vba code

    false not true

    Show modal = False

  18. #18
    Forum Contributor
    Join Date
    05-09-2009
    Location
    Chicago, US
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    188

    Re: adding a progress bar to vba code

    It still won't work. Here is the workbook.

    If you fix it, let me know why it didn't work in the first place. I really like that it is so simple to program it and if it can work like this, that would be awesome!
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    05-09-2009
    Location
    Chicago, US
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    188

    Re: adding a progress bar to vba code

    Another quick question, not related to the progress bar.

    If you look at my code, you will notice that for Loop "For i" I use the value of "firstSMA"...and then the loop works off of that first value and does its job.

    Is there any way of avoiding this? Because idealy, I would like to run two of the exact loops (with different EMAp periods, and then subtract one from the other and then have the difference show in one column. So i would like to take up only 1 column. Right now, I am taking up 3, 1 for the first EMA, 2nd for the second EMA, and third for the difference.

    Is there any way to avoid this? It is just too many unnecessary numbers on the sheet.

  20. #20
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: adding a progress bar to vba code

    the max value needs to be defined
    so change this bit
    Please Login or Register  to view this content.

  21. #21
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: adding a progress bar to vba code

    with your second question you can use collections of each cal then enter the results in the column

+ 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