+ Reply to Thread
Results 1 to 4 of 4

Closing UserForm

  1. #1
    Keri
    Guest

    Closing UserForm

    I am creating a diologue box by creating a UserForm. The UserForm
    automatically has a close button (X). I want to be able to change the value
    of a cell in the worksheet if that button is pushed. The problem is I can't
    seem to find where to write the code, everything I have tried has not worked.


    Please Help

  2. #2
    Toppers
    Guest

    RE: Closing UserForm

    Keri,
    Try this: right click on Userform and "View Code"

    Private Sub UserForm_Terminate()
    MsgBox "Userform Closed"
    ' add code to update your cell

    End Sub

    "Keri" wrote:

    > I am creating a diologue box by creating a UserForm. The UserForm
    > automatically has a close button (X). I want to be able to change the value
    > of a cell in the worksheet if that button is pushed. The problem is I can't
    > seem to find where to write the code, everything I have tried has not worked.
    >
    >
    > Please Help


  3. #3
    Chip Pearson
    Guest

    Re: Closing UserForm

    Use the QueryClose event of the userform. If the X button was
    used to close the form, the CloseMode will be 0. If Unload is
    used to dismiss the form, CloseMode will be 1. See help for
    QueryClose for more details.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "Keri" <[email protected]> wrote in message
    news:[email protected]...
    >I am creating a diologue box by creating a UserForm. The
    >UserForm
    > automatically has a close button (X). I want to be able to
    > change the value
    > of a cell in the worksheet if that button is pushed. The
    > problem is I can't
    > seem to find where to write the code, everything I have tried
    > has not worked.
    >
    >
    > Please Help




  4. #4
    Keri
    Guest

    RE: Closing UserForm

    Thanks that worked great

    "Toppers" wrote:

    > Keri,
    > Try this: right click on Userform and "View Code"
    >
    > Private Sub UserForm_Terminate()
    > MsgBox "Userform Closed"
    > ' add code to update your cell
    >
    > End Sub
    >
    > "Keri" wrote:
    >
    > > I am creating a diologue box by creating a UserForm. The UserForm
    > > automatically has a close button (X). I want to be able to change the value
    > > of a cell in the worksheet if that button is pushed. The problem is I can't
    > > seem to find where to write the code, everything I have tried has not worked.
    > >
    > >
    > > Please Help


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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