Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to increment a cell reference in a row Mike Excel Discussion (Misc queries) 6 May 13th 09 10:04 PM
Can I replace a ' at the beginning of a text cell using Replace Hilde Excel Discussion (Misc queries) 4 September 10th 07 06:22 PM
Increment cell prefix Brettjg Excel Discussion (Misc queries) 2 April 27th 07 09:08 AM
check cell val, increment val DJS Excel Worksheet Functions 0 January 30th 06 10:29 PM
increment cell value automatically Gummy Excel Worksheet Functions 0 November 5th 04 10:30 PM


All times are GMT +1. The time now is 03:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"