View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Loop to add +1 in cell?

right click sheet tabview codeinsert this

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

"bxvang" wrote in
message ...

Hello,

What I want is a button that will add 1 to a number everytime it is
pressed. Can you guys give me any help? Thanks


--
bxvang
------------------------------------------------------------------------
bxvang's Profile:
http://www.excelforum.com/member.php...o&userid=35135
View this thread: http://www.excelforum.com/showthread...hreadid=548932