Counting Clicks
Unless you look at the actual mouse-clicks with the
Windows API, this is the best I can come up with:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim lScrollRow As Long
Dim lScrollColumn As Long
Dim lTargetRow As Long
Dim lTargetColumn As Long
If Target.Row 10 Or Target.Column 10 Then
Exit Sub
End If
Application.ScreenUpdating = False
lScrollRow = ActiveWindow.ScrollRow
lScrollColumn = ActiveWindow.ScrollColumn
lTargetRow = Target.Row
lTargetColumn = Target.Column
Cells(lTargetRow + 10, lTargetColumn) = _
Cells(lTargetRow + 10, lTargetColumn) + 1
Cells(65536, 256).Select
ActiveWindow.ScrollRow = lScrollRow
ActiveWindow.ScrollColumn = lScrollColumn
Application.ScreenUpdating = True
End Sub
Put this in the worksheet code.
It will be simpler if you could do it with a right mouse-click as there is
the
Worksheet_BeforeRightClick event.
RBS
wrote in message
...
This may be a trivial problem, but it has me slightly bugged. Is it
possible to count the number of times an Excel cell has been clicked
on?
What I have in mind is, for example, an array of cells from A1 to I10,
and a corresponding array from A11 to I21.
The idea is that if a cell in the upper array is clicked, the
corresponding cell in the lower array is increased by one. Thus if C3
is clicked, C13 would by incremented.
Is such a thing possible and if so, how?
|