Results 1 to 4 of 4

Progress bar not linking to Macro progress

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365 Version 2501 64-bit
    Posts
    1,465

    Progress bar not linking to Macro progress

    I have a major worksheet with a Macro that populates over two hundred columns sequentially. I need a Progress Bar that shows the end User how many of the columns have been completed.

    I therefore created the simplified attachment to try and achieve that result, but without success.

    Cols A and B on attached have one hundred dummy values drawn from ten sources.
    Code below SHOULD open the Progress bar, which then moves as the total value from each source is added to columns L - U in turn.

    Option Explicit
    Dim b As Long, c As Long, f As Long, e As Long, s As Long
    Dim i As Integer, j As Integer, pctCompl As Single
    
    Sub MATRIX()
    
        UserForm1.Show
        
        Progress
        
        With Sheet1
    
    'Find last row with Data
    
        f = .Cells(.Rows.Count, "A").End(xlUp).Row
        If f < 3 Then f = 3
      
    'Find last Column in sheet
    
        e = .Cells(1, .Columns.Count).End(xlToLeft).Column
        If e < 2 Then e = 2
        
           
    'Count returns
    
            For s = 12 To e
            
            .Cells(2, s) = WorksheetFunction.SumIf(.Range(.Cells(2, 1).Address, .Cells(f, 1).Address), .Cells(1, s), .Range(.Cells(2, 2).Address, .Cells(f, 2).Address))
            
            Next
    
        End With
        
        End Sub
    Unfortunately the Code stops as soon as it calls the Progress Bar, even though my understanding was setting the Bar to "modeless" specifically did not stall the Main Code?

    I am also not confident that the Bar code itself will update as each column is completed?

    Sub Progress()
    
    Dim i As Long, r As Long
    
    With Prog_bar
        
    'SET MIN value to 0
        .ProgressBar1.Min = 0
        
    'SET Max value to last column on sheet
    
        r = .Cells(1, .Columns.Count).End(xlToLeft).Column
        
        .ProgressBar1.Max = r
        
        .Show vbModeless
        
        i = ActiveCell.Column / r
        
    'Change bar value to show the progress
            
            .ProgressBar1.Value = i
            
    'Display the percentage of task completed
            
            .Caption = VBA.Format(i / Prog_bar.ProgressBar1.Max, "0%") & "  Complete"
            
            DoEvents ' DoEvents allows the UserForm to update.
            
            
        End With
    
    'Close bar when Macro finishes
    
    Unload Prog_bar
    
    End Sub
    All solutions, suggestions and alternatives welcome as ever

    Ochimus
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Progress Indicator need to progress along with my code running time
    By Zahid0111 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-04-2020, 12:05 PM
  2. [SOLVED] Message when VBA works; Be patien etc..; Is possible progress bar on progress information?
    By martin81 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-30-2016, 08:43 AM
  3. Replies: 1
    Last Post: 08-06-2014, 10:29 PM
  4. 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
  5. 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
  6. 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. [SOLVED] Progress Bar & Cell Linking
    By Xenoshan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-31-2006, 11:00 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