Prev: no more new fonts may be applied in this workbook when changing fo
Next: Find/Replace Numbers stored as Text drops zeros
From: Kathryn on 21 Apr 2010 11:01 I have created a form in excel 2007 developer that manipulated data on two of the sheets. Somehow I want the customer to be able to activate the form from one of the sheets so they do not have to run it from developer. I tried to create a macro but once the form activates you cannot stop the macro. I am just learning the developer portion of this software so I you have any ideas please share. Thanks Much
From: JLatham on 21 Apr 2010 11:51
Can we see the code you wrote? Actually all that you need to open a UserForm is a one liner as: Sub Button_Click() userFormName.Show End Sub By default, UserForms are displayed as Modal. Meaning that they then take control and their code is in use until they transfer control somehow, usually somewhere within the UserForm you have a button that pretty much wraps it all up as: Sub CancelButton_Click() Unload Me ' takes the userform completely out of memory 'or (and this wouldn't work with the Unload Me still in the code above) Me.Hide ' removes it from view End Sub If you want the form to display and still have other processing continue, set the form's Modal property to false. This is handy if you want to display a form to show some progress indicator or such while the main code continues to run and update the contents of the UserForm: Sub DoALongProcess() NotificationForm.Show 'code in here to do some long process 'with some content of the NotificationForm updated periodically 'during that processing, and then when it's all done Unload NotificationForm End Sub "Kathryn" wrote: > I have created a form in excel 2007 developer that manipulated data on two of > the sheets. Somehow I want the customer to be able to activate the form from > one of the sheets so they do not have to run it from developer. I tried to > create a macro but once the form activates you cannot stop the macro. I am > just learning the developer portion of this software so I you have any ideas > please share. > > Thanks Much |