Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Using Forms in Ecel Macros

  1. #1
    New Member
    Join Date
    May 2002
    Location
    Dallas, TX
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'm writing a macro in excel that calls a user form. On the form I want to have a button that allows the user to return to the origional macro module and continue executing code from the place where it left off. What codes should I use to exit the form and how do I get the orgional module to "remember" where it was?

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    So long as your code looks something like this:


    Public Sub main()

    Dim oRange as Range

    Set oRange = '....blah blah blah

    Userform1.Show 'Your code for showing your userform

    ' Some more code here

    End Sub


    ...The code will continue from the line "Some more code here" when you get rid of the userform.

    Now, the button on your userform, I'm guessing that you simply want to kill the userform and allow the macro to continue. In the buttons click event in the userform code module simplt put this line of code:


    Unload Me


    This will kill the form and return you to the next part of your macro.

    HTH

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •