ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   increment a value by 1 (https://www.excelbanter.com/new-users-excel/75269-increment-value-1-a.html)

Workshops

increment a value by 1
 
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

Gary''s Student

increment a value by 1
 
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


Workshops

increment a value by 1
 
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


Gary''s Student

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



All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com