Count Mouse Clicks On Cell

  • Is there a way of counting mouse clicks on an active XL cell and displaying the real time count in the cell, in essence giving a click count?
    Or in the case of a handheld, tapping an active cell and having the value incrementally increase with each tap...

  • Re: Count Mouse Clicks On Cell

    In Excel 2000 this is the only option that comes near. Don't know if a click event has been added to the Worksheet events. If there is you can use the same code in it.


  • Re: Count Mouse Clicks On Cell

    Winte is a good solution but once you click the cell it wont count the clicks untill you have clicked another cell.

    If this is a problem you could perhaps consider using the before right click event:

    1. Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    2. If Not Intersect(Target, Range("B4")) Is Nothing Then
    3. If IsNumeric(Range("B4").Value) Then
    4. Range("B4").Value = Range("B4").Value + 1
    5. Else
    6. Range("B4").Value = 1
    7. End If
    8. End If
    9. Cancel = True
    10. End Sub

    Or even the before double click event? just throwing in some more options for you.

  • Re: Count Mouse Clicks On Cell

    Maybe you could switch the buttons when clicking on the cell to harness the before right click then switch them back when you click another cell??

    Bit out of my level - as you say though Jack interesting idea.

  • Re: Count Mouse Clicks On Cell

    Don't know the overall requirements of the request BUT you CAN DO this
    via some API's and, as you have suggested swapping the mouse + Event code

    Note: It needs the AddressOf operator so will only work in Xl2000+

    This example Monitors a range = C2:C20 ..... No real testing done.

    You need to Start the timer to monitor the Range ....

    This is just ONE way to do it ... NO Real testing....

  • Re: Count Mouse Clicks On Cell


    I've tried several events :

    Before right click -> Normally left click is used to select a cell
    Before doubbleclick -> Directs to the contents of the cell, selection change required to leave the contents

    Adding a selection change completes it.