+ Reply to Thread
Results 1 to 6 of 6

Progress bar that goes from 0 to 100 in ten seconds - WORKING!

Hybrid View

JJFletcher Progress bar that goes from 0... 05-07-2016, 04:29 AM
djbomaha Re: Progress bar that goes... 05-07-2016, 05:30 AM
JJFletcher Re: Progress bar that goes... 05-07-2016, 06:00 AM
JJFletcher Re: Progress bar that goes... 05-07-2016, 11:27 AM
YasserKhalil Re: Progress bar that goes... 05-07-2016, 03:20 PM
JJFletcher Re: Progress bar that goes... 05-07-2016, 03:30 PM
  1. #1
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    991

    Progress bar that goes from 0 to 100 in ten seconds - WORKING!

    Hi Everyone,

    I would like to know where to get samples of a Progress Bar Macro that goes from 0 to 100 in ten seconds

    Any Thoughts???


    Best Regards,


    John
    Last edited by JJFletcher; 05-07-2016 at 11:29 AM.

  2. #2
    Forum Contributor
    Join Date
    10-19-2012
    Location
    Omaha, Nebraska USA
    MS-Off Ver
    Excel 2010
    Posts
    249

    Re: Progress bar that goes from 0 to 100 in ten seconds ???

    Hi,

    The attached workbook has a simple progress bar example in the VBA editor. It just advances after delaying a second through 10 cycles.

    Hope it provides some direction,

    Dan
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    991

    Re: Progress bar that goes from 0 to 100 in ten seconds ???

    Hi DJBOHAMA,

    Thanks so much for getting this to me - I appreciate this.. I will see if it provides the results I am needing!

    Best Regards,

    John

  4. #4
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    991

    Re: Progress bar that goes from 0 to 100 in ten seconds ???

    Solution is found...

    I want to thank everyone in the Forum... Such a Rich Treasure of Knowledge and willingness to help is absolutely AWESOME!

    Working Progressbar that loads within 10 seconds: This first Code is the ProgressDlg.frm - When sizing the Form I hide the square progress boxes...

    Private Sub UserForm_Activate()
        Call Main
    End Sub
    
    Private Sub UserForm_Initialize()
        With Me.lblDone ' set the "progress bar" to it's initial length
            .Top = Me.lblRemain.Top + 1
            .Left = Me.lblRemain.Left + 1
            .Height = Me.lblRemain.Height - 2
            .Width = 246
        End With
    End Sub
    Sub Main()
    Dim i As Long, tot As Long
        tot = 300000
        ProgressDlg.Caption = "Loading Quality Production Tool..."
        For i = 1 To tot
            If i Mod 5 = 0 Then ProgressBar i / tot
            Next i
        Unload ProgressDlg
    End Sub
    Sub ProgressBar(PctDone As Single)
        With ProgressDlg
            .lblDone.Width = PctDone * (.lblRemain.Width - 2)
            .lblPct.Caption = Format(PctDone, "0%")
        End With
        'The DoEvents statement is responsible for the form updating
        Select Case ProgressDlg.lblPct.Caption
        Case "10%"
            ProgressDlg.Frame1.Visible = True
           
        Case "20%"
            ProgressDlg.Frame2.Visible = True
         
         
        Case "30%"
            ProgressDlg.Frame3.Visible = True
            
          
        Case "40%"
           ProgressDlg.Frame4.Visible = True
                  
        Case "50%"
           ProgressDlg.Frame5.Visible = True
                  
        Case "60%"
            ProgressDlg.Frame6.Visible = True
            
        Case "70%"
         ProgressDlg.Frame7.Visible = True
           
        Case "80%"
         ProgressDlg.Frame8.Visible = True
            
            
        Case "90%"
           ProgressDlg.Frame9.Visible = True
            
         
        Case "100%"
          ProgressDlg.Frame10.Visible = True
                    
        End Select
        DoEvents
        
    End Sub
    Hide Sheet Module :

    Option Private Module
    Sub Hide_Sheet()
        Sheet1.Visible = True
        Sheet2.Visible = False
    
    End Sub

    In ThisWorkbook add this code:

      Private Sub Workbook_Open()
    
      Application.OnTime Now + TimeValue("00:00:10"), "Hide_Sheet"
        
        ProgressDlg.Show
        
     End Sub

    This works Great

    Best Regards,

    John
    Last edited by JJFletcher; 05-07-2016 at 11:28 AM. Reason: grammer

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Progress bar that goes from 0 to 100 in ten seconds - WORKING!

    A little fix for code in Post # 2
    Private Sub UserForm_Activate()
        Dim I As Integer
        
        frameProgress.Caption = ""
        lblProgress.Width = 0
    
        For I = 1 To 10
            Application.Wait (Now + TimeValue("00:00:01"))
            lblProgress.Width = (I * 10 / 100) * frameProgress.Width
            frameProgress.Caption = I * 10 & " of 100"
            frameProgress.Repaint
    
            If (I = 1) Then
                lblProg.Caption = I & " Second"
            Else
                lblProg.Caption = I & " Seconds"
            End If
        Next I
        Unload frmProgressBar
    End Sub
    The fix is using this line with label
     frameProgress.Repaint
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  6. #6
    Forum Contributor
    Join Date
    09-10-2008
    Location
    Phoenix, AZ
    MS-Off Ver
    Office 365
    Posts
    991

    Re: Progress bar that goes from 0 to 100 in ten seconds - WORKING!

    Awesome Yasser,

    This is Great thanks much....


    Say, Maybe you can look at my new post regarding hiding the TAB on the sheet...

    Post - Can the TAB (Sheet Name) at the bottom of the worksheet really be hidden with this Code??


    The guys there say it should work... I tried it and it does not work...

    Best Regards,

    John
    Last edited by JJFletcher; 05-07-2016 at 03:39 PM.

+ 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. Replies: 1
    Last Post: 08-06-2014, 10:29 PM
  2. Bar chart or bar graph for construction progress physical progress
    By pvsvprasadcivil in forum Excel Charting & Pivots
    Replies: 12
    Last Post: 01-08-2014, 02:40 AM
  3. Bar chart or bar graph for construction progress physical progress
    By pvsvprasadcivil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-29-2013, 12:41 PM
  4. convert from seconds to form hours: minutes: seconds?
    By nguyen_han in forum Excel General
    Replies: 2
    Last Post: 10-13-2011, 06:56 AM
  5. Replies: 4
    Last Post: 01-18-2010, 04:29 AM
  6. [SOLVED] NEED Help - How to capture the Event's progress in Progress Bar
    By Sriram in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-22-2006, 07:10 AM
  7. Replies: 2
    Last Post: 02-17-2006, 08:15 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