Update cell in date column to a new date based on data in other cells

Column G is a date column that show the last time a chapter was updated.

I would like the date in Column G to be automatically updated to a static date (example of format: "15 NOV 14") if the following criteria is met:
If Column I, Column N, Column S, Column X, Column AC OR Column AH = "NEW" or "REVISED"
Otherwise, the pre-existing date in Column G is to remain intact and unchanged.

I've attached a sample spreadsheet.

Thanks,
Andrea
LastRevisionDateUpdate-sample.xlsm
AndreamaryAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Glenn RayExcel VBA DeveloperCommented:
The dates in your example workbook are static dates (i.e, constants) right now.  Would these be formulas usually?  If not, what should the new date be converted to?  Today's date?  Another calculated date based on other data?

A Worksheet_Change event should handle this, but will wait to hear clarification from you.

Regards,
-Glenn
0
Glenn RayExcel VBA DeveloperCommented:
Just as an example, here is a Worksheet_Change event that would change the Last Revision Date value in column G to today's date if any of the above-mentioned columns were to be changed.  
Option Explicit
Dim rng As Range
Dim cl As Object
Dim boolChange As Boolean
Dim x As Integer
Private Sub Worksheet_Change(ByVal Target As Range)
    If boolChange Then
        boolChange = False
        Exit Sub
    End If
    Set rng = Range("G2", Range("G2").End(xlDown))
    For Each cl In rng
        For x = 2 To 27 Step 5
            If cl.Offset(0, x) = "New" Or cl.Offset(0, x) = "Revised" Then
                boolChange = True
                cl.Value = Format(Now(), "dd-mmm-yy")
                Exit For
            End If
        Next x
    Next cl
    boolChange = False
End Sub

Open in new window


This code would be inserted into the "Book_Prod_Sept2014" sheet object in the VBA Project.  I've attached a modified version of your file that shows this.  I had to replicate your Data Validation range (TypeChange1) on another sheet to test.

Regards,
-Glenn
EE-LastRevisionDateUpdate-sample.xlsm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AndreamaryAuthor Commented:
Terrific, Glenn...the only modification I made was to line 16 (as shown below) since we use the same date for all changes within a cycle (and not the actual date the change is done on). So for each cycle, I'll update the code with the new 'static' date to be used.

cl.Value = Format("15-Nov-14", "dd-mmm-yy")

Thanks so much!

Cheers,
Andrea
0
Glenn RayExcel VBA DeveloperCommented:
You're welcome.  
-Glenn
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.