View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.newusers
Gary''s Student
 
Posts: n/a
Default increment a value by 1

First enter this in worksheet code:

Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Range("A1:A1"), Target) Is Nothing Then Exit Sub
Application.EnableEvents = False
If Cells(1, 1).Value = 10000 Then
Cells(1, 2).Value = Cells(1, 2).Value + 1
End If
Application.EnableEvents = True
End Sub

This is only a sample. Everytime the worksheet changes, this routine wakes
up briefly. It checks to see if cell A1 has been updated. If no, it goes
back to sleep.

If cell A1 has been updatedn it increments cell A2. You can modify the code
to use other cells.


Just remember that the macro goes in worksheet code, and not a module.

--

Gary's Student


"Workshops" wrote:

Increment by 1 if the total equals 10,000, not more, not less, but equal to
10,000. The nature of the beast is that the typist would only enter a value
that is greater than 9,999 but never over 10k. I hope this is what you need...

"Gary''s Student" wrote:

Do you want the increment only when it changes from below 10K to above 10K,
or anytime is is above 10K?
--
Gary's Student


"Workshops" wrote:

How do I increment, automatically, a cell by 1 if a condition is met? If one
of my cells reaches 10k I want another cell to increment by 1. Can anyone
help me if this function can be done?
Thank you, Ron