Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
add 1 to a sum by clicking mouse?
In Excel, can 1 be added to the sum by clicking once in a cell? For
instacne, if I click once in a cell correspong to the cell that displays the sum of a row, one will be added. Each time I click the mouse, 1 is added to the total? Just like a small hand held clicker. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
add 1 to a sum by clicking mouse?
right click sheet tabview codeinsert thissave. Now when you just select
cell a5 1 will be added to the sum. Option Explicit Dim oldvalue As Double Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$A$5" Or Target.Address = "$B$5" Then Application.EnableEvents = False If Target.Value = 0 Then oldvalue = 0 Target.Value = 1 + oldvalue oldvalue = Target.Value Application.EnableEvents = True End If End Sub Sub fixit() Application.EnableEvents = True End Sub -- Don Guillett SalesAid Software "muzic247" wrote in message ... In Excel, can 1 be added to the sum by clicking once in a cell? For instacne, if I click once in a cell correspong to the cell that displays the sum of a row, one will be added. Each time I click the mouse, 1 is added to the total? Just like a small hand held clicker. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
add 1 to a sum by clicking mouse?
Nope. There's nothing that fires when you click on a cell.
But maybe you could tie into the _beforedoubleclick and _beforerightclick events: If you want to try, rightclick on the worksheet tab that should have this behavior. Select view code and paste this into the code window: Option Explicit Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _ Cancel As Boolean) If Target.Cells.Count 1 Then Exit Sub If Intersect(Target, Me.Range("A:A")) Is Nothing Then Exit Sub Cancel = True 'stop editing in cell If IsNumeric(Target.Value) Then Target.Value = Target.Value + 1 End If End Sub Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, _ Cancel As Boolean) If Target.Cells.Count 1 Then Exit Sub If Intersect(Target, Me.Range("A:A")) Is Nothing Then Exit Sub Cancel = True 'stop pop up from showing If IsNumeric(Target.Value) Then Target.Value = Target.Value - 1 End If End Sub I used any cell in Column A. You can change that in both spots if you want. Doublclicking will add 1. Rightclicking will subtract 1. muzic247 wrote: In Excel, can 1 be added to the sum by clicking once in a cell? For instacne, if I click once in a cell correspong to the cell that displays the sum of a row, one will be added. Each time I click the mouse, 1 is added to the total? Just like a small hand held clicker. -- Dave Peterson |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
add 1 to a sum by clicking mouse?
How about adding a Spinner from the Forms Toolbar
You can click to add or click to reduce. Gord Dibben MS Excel MVP On Tue, 15 Aug 2006 14:48:01 -0700, muzic247 wrote: In Excel, can 1 be added to the sum by clicking once in a cell? For instacne, if I click once in a cell correspong to the cell that displays the sum of a row, one will be added. Each time I click the mouse, 1 is added to the total? Just like a small hand held clicker. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Mouse pointer becomes hyperlink when sheet protected | Excel Discussion (Misc queries) | |||
HELP: Mouse Pointer Changes When Sheet Protected | Excel Discussion (Misc queries) | |||
Is clicking on the tab with my mouse the only way to move from on. | Excel Worksheet Functions | |||
Mouse continues to select after clicking on a cell in excel. | Excel Discussion (Misc queries) | |||
moving mouse highlights cells. why? | Excel Discussion (Misc queries) |