MobileMobile | Continue

Excel Bar

Excel Bar

Your excel questions will be responsed by our excel experts within 24hrs.Our service is free.

 Forgot Pass?
 Register Now
Find
Hot Search: Vlookup Match VBA
12
Return Post new threads
Author: joebbb

How do I change a userform while calculations are ongoing.

[Copy link]

2

Topics

804

Posts

1720

Integral

King

Rank: 6Rank: 6

Integral
1720
Post on 12-14-2016 15:32:38 | All posts



Try this and see if you prefer it


Open the file, enable macros and click on Run
(The VBA contains a loop to simulate your code running)
At various stages in the code (here at the end of each loop)
- the code writes a status update to cell A1
- the UserForm is refreshed by being re-initialized
- TextBox1 takes the latest value from cell A1
Private Sub cb_Run_Click()
Range(A1).Select
DoEvents
Do Until x = 10
    Application.ScreenUpdating = False
        x = x + 1
            For i = 1 To 3000
                ActiveCell.Offset(1, 0).Select
            Next i
    Application.ScreenUpdating = True
    Range(A1).Value = Stage   x
    If x = 10 Then Range(A1).Value = Status Dormant
    DoEvents
    Range(A1).Select
    UserForm_Initialize
    Application.ScreenUpdating = True
Loop
   
End SubPrivate Sub UserForm_Initialize()
TextBox1.Text = Range(A1).Value
DoEvents
End SubPrivate Sub CommandButton1_Click()
    UserForm1.Show vbModeless
End SubPrivate Sub Workbook_Open()
    UserForm1.Show vbModeless
End Sub








  • SimpleUserFormUpdatingOnTheHoof.xlsm
    (22.6 KB, 14 views)
    Download

  • Reply Support Opposition

    Props Report

    2

    Topics

    804

    Posts

    1720

    Integral

    King

    Rank: 6Rank: 6

    Integral
    1720
    Post on 12-14-2016 17:28:23 | All posts



    Try this and see if you prefer it


    Open the file, enable macros and click on Run
    (The VBA contains a loop to simulate your code running)
    At various stages in the code (here at the end of each loop)
    - the code writes a status update to cell A1
    - the UserForm is refreshed by being re-initialized
    - TextBox1 takes the latest value from cell A1
    Private Sub cb_Run_Click()
    Range(A1).Select
    DoEvents
    Do Until x = 10
        Application.ScreenUpdating = False
            x = x + 1
                For i = 1 To 3000
                    ActiveCell.Offset(1, 0).Select
                Next i
        Application.ScreenUpdating = True
        Range(A1).Value = Stage   x
        If x = 10 Then Range(A1).Value = Status Dormant
        DoEvents
        Range(A1).Select
        UserForm_Initialize
        Application.ScreenUpdating = True
    Loop
       
    End SubPrivate Sub UserForm_Initialize()
    TextBox1.Text = Range(A1).Value
    DoEvents
    End SubPrivate Sub CommandButton1_Click()
        UserForm1.Show vbModeless
    End SubPrivate Sub Workbook_Open()
        UserForm1.Show vbModeless
    End Sub








  • SimpleUserFormUpdatingOnTheHoof.xlsm
    (22.6 KB, 16 views)
    Download

  • Reply Support Opposition

    Props Report

    2

    Topics

    804

    Posts

    1720

    Integral

    King

    Rank: 6Rank: 6

    Integral
    1720
    Post on 12-14-2016 19:40:00 | All posts



    Try this and see if you prefer it


    Open the file, enable macros and click on Run
    (The VBA contains a loop to simulate your code running)
    At various stages in the code (here at the end of each loop)
    - the code writes a status update to cell A1
    - the UserForm is refreshed by being re-initialized
    - TextBox1 takes the latest value from cell A1
    Private Sub cb_Run_Click()
    Range(A1).Select
    DoEvents
    Do Until x = 10
        Application.ScreenUpdating = False
            x = x + 1
                For i = 1 To 3000
                    ActiveCell.Offset(1, 0).Select
                Next i
        Application.ScreenUpdating = True
        Range(A1).Value = Stage   x
        If x = 10 Then Range(A1).Value = Status Dormant
        DoEvents
        Range(A1).Select
        UserForm_Initialize
        Application.ScreenUpdating = True
    Loop
       
    End SubPrivate Sub UserForm_Initialize()
    TextBox1.Text = Range(A1).Value
    DoEvents
    End SubPrivate Sub CommandButton1_Click()
        UserForm1.Show vbModeless
    End SubPrivate Sub Workbook_Open()
        UserForm1.Show vbModeless
    End Sub








  • SimpleUserFormUpdatingOnTheHoof.xlsm
    (22.6 KB, 18 views)
    Download

  • Reply Support Opposition

    Props Report

    12
    Return Post new threads

    Points policy of this forum

    Archiver|Mobile|Small dark house|Contact us|Excel Bar

    GMT-5, 9-20-2017 11:35 , Processed in 0.262180 second(s), 17 queries .

    Powered by Discuz! X3

    © 2001-2013 Comsenz Inc.

    !fastreply! Top !return_list!