Results 1 to 9 of 9

Creating a Progress Bar

Threaded View

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

    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:

     Enum ReadColumns
        rcLineItem = 2
        rcItemCode = 3
        rcUnits = 6
        rcSupplementalDescription = 4
        rcUnitPrice = 5
        rcOriginalPlanQuantity = 7
        rcCurrentPlanQuantity = 8
        rcCategory = 1
    End Enum
    Sub MergeandFillHeader()
    
        Dim v As Variant, i As Long
        Dim wb As Workbook, n As Long
    
        With Application
            .ScreenUpdating = False
            .Calculation = xlAutomatic
        End With
        
        
        With ThisWorkbook
            v = .Worksheets("Data").Range("C11").CurrentRegion.Value
            For i = 3 To UBound(v)
                If Not v(i, rcItemCode) = vbNullString Then
                    Set wb = Workbooks.Open(.Worksheets("Merge").Range("D5").Value & "\" & v(i, rcItemCode) & ".xlsm")
                    wb.Sheets(1).Copy After:=.Sheets(.Sheets.Count)
                    With .Sheets(.Sheets.Count)
                        .Cells(1, 4).Value = Worksheets("Merge").Range("D3").Value
                        .Cells(2, 4).Value = "=Data!A" & 8 + i
                        .Cells(3, 4).Value = "=Data!B" & 8 + i
                        .Cells(4, 4).Value = "=Data!C" & 8 + i
                        .Cells(5, 4).Value = "=Data!D" & 8 + i
                        .Cells(6, 4).Value = "=Data!E" & 8 + i
                        .Cells(7, 4).Value = "=Data!F" & 8 + i
                        .Cells(8, 4).Value = "=Data!G" & 8 + i
                        .Cells(9, 4).Value = "=Data!H" & 8 + i
                    End With
                    n = n + 1
                    wb.Close False
                End If
            Next i
        End With
        
        
        With Application
            .ScreenUpdating = True
            .Calculation = xlCalculationAutomatic
        End With
        
    Worksheets("Merge").Activate
        
        MsgBox "Processed " & n & " files", Title:="Merge Excel files"
        
    End Sub

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

      Progress.Bar.Width = 0
        Progress.Show
        For i = 1 To lastrow
        
            pctdone = i / lastrow
            With Progress
            .Percent = "Processing Item" & i & "of" & lastrow
            .Bar.Width = pctdone * (.ProgressBackground.Width)
        End With
    And I have been placing this after "next i" in the main code

    If i = lastrow Then Unload Progress
    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] 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. 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