Results 1 to 2 of 2

Run macro by double-clicking a cell?

This is a discussion on Run macro by double-clicking a cell? within the Excel Questions forums, part of the Question Forums category; Hi, i would like to run a macro that shows a pop-up list by double clicking on the specific cell. ...

  1. #1
    Board Regular
    Join Date
    Sep 2002
    Location
    currently UK
    Posts
    95

    Default

    Hi, i would like to run a macro that shows a pop-up list by double clicking on the specific cell.
    so far i have a button to start the macro, but thats really uncomfortable.
    Basically i would like to double click a cell and let the pop-up list appear.
    Ideas anyone?

  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209

    Default

    On 2002-09-23 19:04, djsmarties wrote:
    Hi, i would like to run a macro that shows a pop-up list by double clicking on the specific cell.
    so far i have a button to start the macro, but thats really uncomfortable.
    Basically i would like to double click a cell and let the pop-up list appear.
    Ideas anyone?
    Excel2000


    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Address = "$B$10" Then
    MsgBox "running your macro"
    '// run your macro here
    End If
    End Sub

    ****** content=Excel.Sheet name=ProgId>****** content="Microsoft Excel 9" name=Generator>**
    *****
    *WorkSheet_BeforeDoubleClick*
    *****
    *STEP*' HOW* JOK*
    *1*Press Alt-F11 to display the Visual Basic editor (VBE).*
    *****
    *2*In the Project Explorer window, find an entry for the sheet you're working with. (For example, look for Sheet1 if the cells you're working on are on that sheet.) If you don't see the Project Explorer window, press Ctrl-R.*
    *****
    *3*Double-click the sheet entry in the Project Explorer window.*
    *****
    *4*Above the code window, you'll find two drop-down lists. In the list on the left, choose Worksheet. In the list on the right, choose BeforeDoubleClick.*
    *****
    *5*A procedure template for WorkSheet_BeforeDoubleClick now appears in the code window. Between the Private Sub line and the End Sub line, type in your procedure.*
    *****
    *eg.For example your WorkSheet_BeforeDoubleClick procedure would look like this:*
    *****
    *Code:Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)*
    ***** If Target.Address = "$B$10" Then**
    **** MsgBox "running your macro"**
    **** '// run your macro here**
    *** End If**
    **End Sub**
    *****
    ** HTH - Ivan F Moala **
    *****

    Kind Regards,
    Ivan F Moala From the City of Sails

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
  •  


DMCA.com