+ Reply to Thread
Results 1 to 2 of 2

Closing userforms when moving between worksheets

Hybrid View

  1. #1
    Registered User
    Join Date
    07-06-2007
    Posts
    1

    Closing userforms when moving between worksheets

    Is there a way to close a userform when a user moves out of the active worksheet. I have a workbook with 3 worksheets. On each sheet is a command that opens a modeless userform.

    I would like to know if there is a way to deactivate the modeless userform is the user selects another worksheet without closing the userform first.

    Regards.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Use the Worksheet_Activate & Deactivate events.

    http://www.excel-it.com/Forum/viewtopic.php?t=11

    This code will load UserForm1 as the sheet is activated, and hide or unload it when the sheet is deactivated

    Option Explicit
    
    Private Sub Worksheet_Activate()
    UserForm1.Show
    End Sub
    
    Private Sub Worksheet_Deactivate()
    UserForm1.Hide 'or
    'Unload UserForm1
    End Sub
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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