Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I need to incrementally increase or decrease cell values until I get an exact
result in a dependant cell:- 19.9, 19.8, 19.7...19.5...bingo! Is there a way that I can achieve this with mouse clicks...each click subtracts/adds 0.1 - or any other integer that I specify - to the cell value? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
With a double click,
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Address = "$A$1" Then 'Change to suit If IsNumeric(Target) Then On Error Resume Next Target = Target - 0.1 ActiveCell.Offset(0, 1).Select On Error GoTo 0 End If End If End Sub Mike Mike "Al" wrote: I need to incrementally increase or decrease cell values until I get an exact result in a dependant cell:- 19.9, 19.8, 19.7...19.5...bingo! Is there a way that I can achieve this with mouse clicks...each click subtracts/adds 0.1 - or any other integer that I specify - to the cell value? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Al,
I missed you wanted to add or subtract so try this. A plus sign in B1 makes it add. B1 blank makes ot subtract. Mike Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Address = "$A$1" Then If IsNumeric(Target) Then On Error Resume Next If ActiveCell.Offset(0, 1).Value = "+" Then Target = Target + 0.1 Else Target = Target - 0.1 End If ActiveCell.Offset(0, 1).Select On Error GoTo 0 End If End If End Sub "Al" wrote: I need to incrementally increase or decrease cell values until I get an exact result in a dependant cell:- 19.9, 19.8, 19.7...19.5...bingo! Is there a way that I can achieve this with mouse clicks...each click subtracts/adds 0.1 - or any other integer that I specify - to the cell value? |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Wow, instant response...thanks v much. Afraid you are talking a language I
do not understand, so I'm going to take your routine and ask someone in my office if they can "translate" for me! Again, thanks for your help! "Mike H" wrote: Al, I missed you wanted to add or subtract so try this. A plus sign in B1 makes it add. B1 blank makes ot subtract. Mike Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Address = "$A$1" Then If IsNumeric(Target) Then On Error Resume Next If ActiveCell.Offset(0, 1).Value = "+" Then Target = Target + 0.1 Else Target = Target - 0.1 End If ActiveCell.Offset(0, 1).Select On Error GoTo 0 End If End If End Sub "Al" wrote: I need to incrementally increase or decrease cell values until I get an exact result in a dependant cell:- 19.9, 19.8, 19.7...19.5...bingo! Is there a way that I can achieve this with mouse clicks...each click subtracts/adds 0.1 - or any other integer that I specify - to the cell value? |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Al,
To use it right click the sheet tab you want to use it on and then click view code and paste the code in there. As to how it works it uses an Excel event (before double click) and if the cell double clicked is A1 it checks what is in the cell 1 cell to the right - offset(0,1) - if it finds a + sign it adds .1 to the target cell and if it doesn't it subtracts .1 Mike Mike "Al" wrote: Wow, instant response...thanks v much. Afraid you are talking a language I do not understand, so I'm going to take your routine and ask someone in my office if they can "translate" for me! Again, thanks for your help! "Mike H" wrote: Al, I missed you wanted to add or subtract so try this. A plus sign in B1 makes it add. B1 blank makes ot subtract. Mike Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Address = "$A$1" Then If IsNumeric(Target) Then On Error Resume Next If ActiveCell.Offset(0, 1).Value = "+" Then Target = Target + 0.1 Else Target = Target - 0.1 End If ActiveCell.Offset(0, 1).Select On Error GoTo 0 End If End If End Sub "Al" wrote: I need to incrementally increase or decrease cell values until I get an exact result in a dependant cell:- 19.9, 19.8, 19.7...19.5...bingo! Is there a way that I can achieve this with mouse clicks...each click subtracts/adds 0.1 - or any other integer that I specify - to the cell value? |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
create up and down arrows to increase and decrease value in a cell | Excel Worksheet Functions | |||
increase/decrease decimal | Excel Worksheet Functions | |||
% of increase or decrease | Excel Discussion (Misc queries) | |||
How do I set a cell that can increase but never decrease? | Excel Discussion (Misc queries) | |||
Value Increase/Decrease/No Change | Excel Worksheet Functions |