Results 1 to 5 of 5

How To Keep Running Program When Other Command Button Clicked

Threaded View

  1. #1
    Forum Contributor
    Join Date
    11-17-2013
    Location
    Qatar
    MS-Off Ver
    Excel 2010
    Posts
    230

    Thumbs up How To Keep Running Program When Other Command Button Clicked

    Hello Brother,

    I need your golden hands to solved the code as below,
    Option Explicit
    Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    Sub FillBottleA()
    Application.ScreenUpdating = False
        Const valIncrement As Double = 2
        Dim intMax As Integer
        Dim intIndex As Integer
        Dim intCalc As Double
        
        intMax = 50
        
        For intIndex = 1 To intMax
            DoEvents
            intCalc = intCalc + valIncrement
            UserForm1.TextBox1 = Round(intCalc, 1)
            Sleep 100
        Next
    Application.ScreenUpdating = True
    End Sub
    
    Sub FillBottleB()
    Application.ScreenUpdating = False
        Const valIncrement As Double = 2
        Dim intMax As Integer
        Dim intIndex As Integer
        Dim intCalc As Double
        
        intMax = 50
        
        For intIndex = 1 To intMax
            DoEvents
            intCalc = intCalc + valIncrement
            UserForm1.TextBox2 = Round(intCalc, 1)
            Sleep 100
        Next
    Application.ScreenUpdating = True
    End Sub
    This code will use to run in UserForm1 under CommandButton1 and CommandButton2, please see the file attachment for detail.
    My question is,
    1. When the program is running under CommandButton1, then I clicked CommandButton2, the running program will be stopped, not continues running.
    What code should i write to protect the running program if other CommandButton will be clicked?
    2. If the program running in UserForm1, then i moved to UserForm2, also the program stopped running.
    What code should i write it to protect the program to continues running though i opened other UserForm?

    Thanks in advance for any small helps and efforts.

    Best Regards,
    Iqbal

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Pull a Hidden frame when clicked command button.
    By venkcris in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-02-2014, 08:52 PM
  2. Running a cell formula only when a button is clicked
    By helen269 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-23-2012, 01:51 PM
  3. VBA to automatically move command button to another cell after being clicked on
    By vaznlyfe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-23-2012, 11:29 AM
  4. Command Button does not re-set once clicked
    By Jurrasicway in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-09-2006, 09:25 AM
  5. [SOLVED] [SOLVED] running a command button from a program
    By Pete at Sappi Fine Paper in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-05-2005, 11:06 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