Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Increment and replace a cell value
I am trying to get a cell (B1) -- a date -- to increment by 14 if cell (A1)
="Yes". The bigger picture is that I have many tasks that require status updates. I want to use column A to reference another worksheet to determine if an update has been received. If the update has been received then A(x) will become a "Yes". If A(x) is "Yes" the Due Date in cell B(x) will increase by 14-days and return that date value. Ideally, I would like the equation for B(x) to increment by 14 and cause A(x) to be returned to "". Is this possible in Excel 2003??? Thanks!! |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Increment and replace a cell value
The following event macro monitors A1 thru A10. If any of the cells in this
range becomes "Yes", then that cell is cleared and the adjacent cell in column B is incremented by 14 Private Sub Worksheet_Change(ByVal Target As Range) Set t = Target If Intersect(t, Range("A1:A10")) Is Nothing Then Exit Sub If t.Value < "Yes" Then Exit Sub Application.EnableEvents = False t.Value = "" t.Offset(0, 1).Value = t.Offset(0, 1).Value + 14 Application.EnableEvents = True End Sub Because it is worksheet code, it is very easy to install and use: 1. right-click the tab name near the bottom of the window 2. select View Code - this brings up a VBE window 3. paste the stuff in and close the VBE window If you save the workbook, the macro will be saved with it. To remove the macro: 1. bring up the VBE windows as above 2. clear the code out 3. close the VBE window To learn more about macros in general, see: http://www.mvps.org/dmcritchie/excel/getstarted.htm To learn more about Event Macros (worksheet code), see: http://www.mvps.org/dmcritchie/excel/event.htm -- Gary''s Student - gsnu200909 "Doc77" wrote: I am trying to get a cell (B1) -- a date -- to increment by 14 if cell (A1) ="Yes". The bigger picture is that I have many tasks that require status updates. I want to use column A to reference another worksheet to determine if an update has been received. If the update has been received then A(x) will become a "Yes". If A(x) is "Yes" the Due Date in cell B(x) will increase by 14-days and return that date value. Ideally, I would like the equation for B(x) to increment by 14 and cause A(x) to be returned to "". Is this possible in Excel 2003??? Thanks!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to increment a cell reference in a row | Excel Discussion (Misc queries) | |||
Can I replace a ' at the beginning of a text cell using Replace | Excel Discussion (Misc queries) | |||
Increment cell prefix | Excel Discussion (Misc queries) | |||
check cell val, increment val | Excel Worksheet Functions | |||
increment cell value automatically | Excel Worksheet Functions |