• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to run code while userform is still activated

ThrottleWorks

Excel Ninja
Hi,

I am running a macro.
I have created an User Form in the macro.

This user form is used as a information purpose (please wait, macro running).

Code:
Dim LR As Range
    MyForm.Show
   
    Application.ScreenUpdating = False
    Sheets("database").Select

My problem is, when I activate the userform, the code stops working there.

I have to close the user form manually to run the macro.
Is there a way, where the user form will be visible on the screen & at the same time code will run.

Can anyone please help me in this.
 
By default userforms are vbmodal so they act as blocking forms. So the next line won't get executed until you close the form.

Try like this:
Code:
Dim LR as Range
MyForm.Show vbModeless
Application.ScreenUpdating = False

Please note that the userform will lose focus but it will stay there.
 
Hi Shrivallabha, thanks a lot for the help.

It is working now, have a nice day ahead :)

P.S. - I think I was told same thing earlier also on this forum only, but I forgot :(
 
Back
Top