Consulting

Page 2 of 2 FirstFirst 1 2
Results 21 to 25 of 25

Thread: Progress Bar VBA

  1. #21
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Quote Originally Posted by jazz2409 View Post
    What do you mean text statusing? You mean like in Excel's actual status bar?

    I tried to incorporate your progress bar from one of your posts here in this thread. But it just froze and it wasn't showing anything. Maybe I should just give up on the idea of adding one.
    Well, I have DoEvents in incorportated into my modules in PB_Demo_1.xlsm modules in Post #9 and none of them freeze. Do you have events turned off? Did you call the 3 Subs like in the Usage:?

    '   ver 06  4/24/2020'       rewrite
    '
    '   Requires
    '       ufStatusMessage
    '
    'Usage
    'Sub test()
    '
    '    Call msgStatusInit("Starting up", "Testing Status Message")
    '    Call msgStatusUpdate("Now doing 1 " & ".......", "Step 1 of 3", 1000)
    '    Call msgStatusUpdate("Now doing 2 " & ".......", "Step 2 of 3", 1000)
    '    Call msgStatusUpdate("Now doing 3 " & ".......", "Step 3 of 3", 1000)
    '    Call msgStatusDone("Yea!!! All Done", 2000)
    '
    'End Sub
    '
    '
    'Sub test2()
    '    Dim i As Long
    '
    '    Call msgNumberInit("Now Processing", 200, "Testing Percent Status Message")
    '    For i = 1 To 200
    '        Call msgNumberUpdate(i, 200)
    '    Next i
    '    Call msgNumberDone("Finished!!", 1000)
    'End Sub
    Not Excel's status bar. Button6 displays a text message in a UserForm box with status information, Button7 displays a text message with percent complete
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  2. #22
    VBAX Tutor
    Joined
    Jan 2020
    Posts
    204
    Location
    Hi Paul H, Here's a sample workbook. I could not include all the data because it would be too difficult to change things
    Attached Files Attached Files

  3. #23
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    I added some text progress messages to the macro that the button runs

    There's an awful lot of calculation going on

    Do you need to use VBA to insert formulas which have to be calculated, or can you just use the data in the macro and put the result n the worksheet?
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  4. #24
    VBAX Tutor
    Joined
    Jan 2020
    Posts
    204
    Location
    Hmmmm I believe I need the formula because the data are daily and I need to compute the weekly and monthly..
    but then I convert all of them to values only, I just forgot to add the sub


    Is it possible to get the same results if I use the data in the macro and put the result n the worksheet?
    Last edited by jazz2409; 05-14-2020 at 09:25 PM.

  5. #25
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    I'd say so, if the user doesn't change the inputs, then the macro can recalc the dependent data

    There's a hybrid approach - use a macro to compute 'static' parameters and have formulas in the WS to use any dependent data that the user might change

    For (made up) example

    1. Load raw data
    2. Process data with macro to add any derived values as values not formulas (e.g. add column for MM/YY and fill it in the macro from a Date as a Value).
    3. Make a pivot table


    These are very simple examples, no IF's for example

    Option Explicit
    
    
    'math way
    Sub DoData()
        Dim rData As Range
        Dim r As Long, c As Long
        Dim x As Double
        
        Set rData = Worksheets("Macro").Cells(1, 1).CurrentRegion
    
    
        For r = 2 To rData.Rows.Count
            x = 0#
            For c = 1 To rData.Columns.Count - 1
                x = x + rData.Cells(r, c).Value
            Next c
            
            rData.Cells(r, rData.Columns.Count).Value = x
        Next r
    
    
    End Sub
    
    
    'WS formula way
    Sub DoData1()
        Dim rData As Range, rTemp As Range
        Dim r As Long, c As Long
        Dim x As Double
        
        Set rData = Worksheets("Macro").Cells(1, 1).CurrentRegion
    
    
        For r = 2 To rData.Rows.Count
            Set rTemp = Range(rData.Cells(r, 1), rData.Cells(r, rData.Columns.Count - 1))
            rData.Cells(r, rData.Columns.Count).Value = Application.WorksheetFunction.Sum(rTemp)
        Next r
    End Sub
    Attached Files Attached Files
    Last edited by Paul_Hossler; 05-15-2020 at 12:40 PM.
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •