+ Reply to Thread
Results 1 to 2 of 2

MACRO code on right-clicking a cell

Hybrid View

  1. #1
    Registered User
    Join Date
    07-03-2011
    Location
    Manila
    MS-Off Ver
    Excel 2007
    Posts
    1

    MACRO code on right-clicking a cell

    My problem is that I want to right click a cell using MACRO.

    Does MACRO have codes corresponding to this?

  2. #2
    Registered User
    Join Date
    06-29-2011
    Location
    California
    MS-Off Ver
    Excel 2003/2007
    Posts
    58

    Re: MACRO code on right-clicking a cell

    You can use the following under a sheet module if you want right click to only work for specific targets (targets being a specific selection of cells)...

    Otherwise, just remove the If statements and use the call, or just put ur code directly under the private sub.


    Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    If Target = ***insert here the target range you want*** Then
    Call YOURRIGHTCLICKMACRO
    End If
    End Sub

    'This code can be stored either under the sheet, or in any other code module


    Sub YOURRIGHTCLICKMACRO()
    msgbox "you click right click"
    
    End Sub



    *EDIT*

    After re-reading your post I think I misunderstood you... What you're saying is you want the right-click edit menu to pop up on a macro command?

    You can use a macro to call the "edit" commandbarpopup whenever you execute your macro.

    Let me know if that's what you want and I can supply the code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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