• Run a procedure when any cell is activated (VBA/Excel2000/SP-3)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Run a procedure when any cell is activated (VBA/Excel2000/SP-3)

    Author
    Topic
    #416693

    I am certain that this is possible, but seem unable to find any reference to get me started.
    I will have a range of cells on a given page populated with text that I intend to use as a variable in a VBA procedure. I want the procedure to run each time any cell on that sheet is activated using the mouse.
    Any pointers will be greatly appreciated.

    Viewing 0 reply threads
    Author
    Replies
    • #932794

      You can use the Worksheet_SelectionChange event of the worksheet:
      – Right click the sheet tab of the worksheet.
      – Select View Code from the popup menu.
      – Select Worksheet from the Object dropdown list in the upper left corner of the module window.
      Excel creates the first and last lines of the event procedure for you:

      Private Sub Worksheet_SelectionChange(ByVal Target As Range)

      End Sub

      In this procedure, Target represents the current selection in the worksheet. Note that this can consist of more than one cell. You can write code to do something with the selection.

    Viewing 0 reply threads
    Reply To: Run a procedure when any cell is activated (VBA/Excel2000/SP-3)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: