The PROCEDURE needs to be placed in a MODULE (as oppose to a USERFORM) where it can be publicly accessed
I have 10 different UserForms in a workbook, all of which have a 'Cancel" button. When this is clicked on any of the 10 forms I want to clear parts of the input area (for example, cells B2:B5 and B7). I can do this now by coding this into the Cancel.Click event on the UserForm code but I have to enter the same code into each of the 10 forms. This is a problem if I need to update the areas to be cleared because I have to update all 10 forms.
I wrote a module called Reset() in ThisWorkbook to accomplish the same thing but I cannot seem to call it from the UserForm Cancel.Click event. Relevant code is below (Reset first then the UserForm code):
Code:Public Sub Reset() MsgBox ("Test") 'Clear out the partially entered data Worksheets("Input").Range("B2:B5").Value = "" Worksheets("Input").Range("B7").Value = "" End SubThoughts? It's probably something simple but I can't seem to get it.Code:Private Sub CmdCancel_Click() Call Reset 'Kill the form Unload Me End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)