![]() |
increase cell value
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?? |
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?? |
All times are GMT +1. The time now is 02:20 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com