View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default increase cell value

Put the following in worksheet code:


Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Intersect(Target, Range("A1")) Is Nothing Then
Application.EnableEvents = True
Exit Sub
Else
Range("A1").Value = Range("A1").Value + memory
memory = Range("A1").Value
End If
Application.EnableEvents = True
End Sub

Put the following in a standard module:

Public memory
Sub ordinate()
memory = 0
End Sub

This uses cell A1 as an example. Whatever you enter in A1 will be added to
the previous contents.


Run ordinate to clear the memory.
--
Gary's Student


"Hottshot8226" wrote:

How do i create a macro to increase a cell value by a variable number. say
the cell is 12 i want to add 3 to it just by typing in 3 instead of 15. is
that possible??