Consulting

Results 1 to 5 of 5

Thread: Hide userform by clicking outside form

  1. #1
    VBAX Regular
    Joined
    Sep 2008
    Posts
    13
    Location

    Hide userform by clicking outside form

    Hello

    I want to hide my user form not when i click on some button, but when i just click outside the form.

    Is there a way to insert column, without changing columns alphabetic letters ? For example, can i between column A an column B insert column with letter AX ?

    I am not using list on my table, so when i click on column letter it selects whole column including first row, but i need to select whole column except first row, so when i want to clear column contents first row (column title) stay.

    Thanks for helping

  2. #2
    Quite different questions you have here.

    1: can be done.

    Put this code in the module behind your form:

    Option Explicit
    Private WithEvents oApp As Application
    Private Sub oApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
        Me.Hide
    End Sub
    Private Sub UserForm_Initialize()
        Set oApp = Application
    End Sub
    2. Impossible, all you can do is create your own headings in the first row of the table

    3. All you can do is select the cells you need.
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  3. #3
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    For (1), be sure to set ShowModal=False or show the userform as vbmodeless.

    For (3), select the whole column by clicking the column letter as you did. To toggle one of the selections, hold the Ctrl key down and click the cell to toggle selection but keep the other cells selected.

  4. #4
    Duh, forgot to add my module code with...
    Userform1.Show vbModeless
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  5. #5
    VBAX Regular
    Joined
    Sep 2008
    Posts
    13
    Location
    Thanks for your help alot.

    vbModeless was thing what i really needed.
    [VBA]If Target.Column = 9 Then
    UserForm1.Show vbModeless
    Else
    UserForm1.Hide
    End If[/VBA]

    I solve my problem with code like this

    thanks again

Posting Permissions

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