Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
al al is offline
external usenet poster
 
Posts: 363
Default Mouse click to increase/decrease a cell value?

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Mouse click to increase/decrease a cell value?

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Mouse click to increase/decrease a cell value?

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   Report Post  
Posted to microsoft.public.excel.misc
al al is offline
external usenet poster
 
Posts: 363
Default Mouse click to increase/decrease a cell value?

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Mouse click to increase/decrease a cell value?

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?



  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Mouse click to increase/decrease a cell value?

In article ,
says...
Just testing re the integer...but your pointing me towards the Goal Seek
capability is perfect. Thanks!

{snip}

You are welcome.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
create up and down arrows to increase and decrease value in a cell Bill Excel Worksheet Functions 1 June 13th 07 09:18 PM
increase/decrease decimal cbfinancial Excel Worksheet Functions 2 April 10th 06 10:43 PM
% of increase or decrease Neil R Excel Discussion (Misc queries) 9 November 27th 05 03:13 AM
How do I set a cell that can increase but never decrease? Rich Excel Discussion (Misc queries) 2 November 2nd 05 06:04 PM
Value Increase/Decrease/No Change Michael Excel Worksheet Functions 1 November 5th 04 11:32 AM


All times are GMT +1. The time now is 09:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"