increment a value by 1

G

Guest

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
 
G

Guest

Do you want the increment only when it changes from below 10K to above 10K,
or anytime is is above 10K?
 
G

Guest

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...
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top