Results 1 to 8 of 8

Thread: double click userform
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jul 2019
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default double click userform

    I want to double click on a row, application.workbook.worksheet(1).range ("A1"). When I double click on it it shows a pop out a userform

    Thank you in advance

  2. #2
    Board Regular Johnny C's Avatar
    Join Date
    Nov 2006
    Location
    Liverpool, UK
    Posts
    993
    Post Thanks / Like
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Default Re: double click userform

    you need to go to the code for the worksheet, and create a worksheet_DblClick event with something like this:

    If target.col = 1 and target.row = 1 then Call LoadForm (or whatever your macro is)
    "If you think this Universe is bad, you should see some of the others" - Philip K. DiĘk

  3. #3
    New Member
    Join Date
    Jul 2019
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: double click userform

    hi johnny C

    i tried this for initial testing

    Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Column = 1 And Target.Row = 1 Then
    MsgBox ("HI")

    End If

    End Sub

    it doesnt work. I want my double click only work on row A only

  4. #4
    New Member
    Join Date
    Jul 2019
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: double click userform

    sorry about that, it works, i wrote it like below

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Column = 1 And Target.Row = 1 Then
    MsgBox ("Hi")

    End If

    End Sub

    How could I write a code for the entire colum A1 until all below

  5. #5
    Board Regular Johnny C's Avatar
    Join Date
    Nov 2006
    Location
    Liverpool, UK
    Posts
    993
    Post Thanks / Like
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Default Re: double click userform

    I'll have a look tomorrow. My PC is running an all-night job at the moment.
    "If you think this Universe is bad, you should see some of the others" - Philip K. DiĘk

  6. #6
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling, Scotland
    Posts
    75,190
    Post Thanks / Like
    Mentioned
    63 Post(s)
    Tagged
    6 Thread(s)

    Default Re: double click userform

    If you want to use double click try this.
    Code:
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
        If Target.Column = 1 And Target.Row = 1 Then
            Cancel = True
            MsgBox "Hi!"
        End If
    End Sub
    If posting code please use code tags.

  7. #7
    Board Regular Johnny C's Avatar
    Join Date
    Nov 2006
    Location
    Liverpool, UK
    Posts
    993
    Post Thanks / Like
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Default Re: double click userform

    Thanls Norie.
    IIRC BeforeDoubleClick isnt listed as an option on wrksheet events, or it didnt used to be but you could still use it.

  8. #8
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling, Scotland
    Posts
    75,190
    Post Thanks / Like
    Mentioned
    63 Post(s)
    Tagged
    6 Thread(s)

    Default Re: double click userform

    Pretty sure it is, that's how I got the code stub anyway.
    If posting code please use code tags.

Some videos you may like

User Tag List

Tags for this Thread

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
  •