Record and retain the date when cell value was FIRST changed!

Phil Payne

Board Regular
Joined
May 17, 2013
Messages
131
Office Version
  1. 365
Platform
  1. Windows
Hello all

I need your expert assistance again please.

I have status columns with validated codes (ascending from 1 to 11) on Sheet1 that when selected by the user inputs the date of change of status into an adjacent cell. Over time the status changes from 1 through to 11 and on each change of status the date in the adjacent cell changes accordingly.

All that is OK but now I need to record when a particular status is reached that, when subsequently changed, will not change the status date. (I need to retain for the record when each status 9 was achieved.)

Is there a way to record and retain the date when status value was FIRST changed to Status 9?

I presently display all the status dates found on Sheet1 (up to 6026) on Sheet2. I am hoping to modify the Sheet2 formula or employ VBA to get what I need.

I hope someone can provide a solution.

Thanks very much!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hello Jim,

Its very large and for ease of description I fibbed about the sheet numbers!
Sheet 1 'Data Sheet' (the source) is sheet3 of 23 and 'Sheet2' is 18 of 23 but I will try to provide cut down version asap.

Thank for the prompt response.
 
Upvote 0
Hello again Jim,

Sorry but it would take far too long to produce a sanitised version of my workbook. I hope images and typical formula will help.

For info the formula in cell D4 of sheet2 is typical of all cells on that sheet. "=IF(($B4='Data Sheet'!$F15)*('Data Sheet'!U15='Defects Liability Starts'!$A$1),'Data Sheet'!W15,0)"

Just found that I can't place an image in the message as its looking for an URL that I cannot provide.

Thanks for your time anyway!

Regards,
 
Upvote 0
I created a new sample workbook - copy the below code into the Code Sheet (not a standard code module). This might give you some ideas.. Enter into Range F3:F6 todays Date (11/03/2014) repeatedly. As you do watch the Stat Num Code Climb up each time to a max of 9. After that you will get a Message - you cannot change further... Jim



Excel 2012
BCDEF
1*** LAST ***
2Job NameStatusStat Num CodeStatus DateCurrent Change Date
3Job 1Mid-Point810/21/2014
4Job 2Final910/31/2014
5Job 3Just Started69/30/2014
6Job 4Open410/15/2014
Sheet1



Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("F:F")) Is Nothing Then Exit Sub
Application.EnableEvents = False
    If Target.Value <> "" Then
    If Target.Offset(, -2) < 9 Then
        Target.Offset(, -2) = Target.Offset(, -2).Value + 1
        Target.Offset(, -1) = Target.Value
    Else
    MsgBox "You have previously acheived Status 9" _
           & vbNewLine & "You Cannot Change this any longer."
    End If
    End If
Application.EnableEvents = True
End Sub
 
Upvote 0
Thank you very much for your time Jim,

I'll get back to you tomorrow.

Cheers.



I created a new sample workbook - copy the below code into the Code Sheet (not a standard code module). This might give you some ideas.. Enter into Range F3:F6 todays Date (11/03/2014) repeatedly. As you do watch the Stat Num Code Climb up each time to a max of 9. After that you will get a Message - you cannot change further... Jim


Excel 2012
BCDEF
Job NameStatus
Job 1Mid-Point
Job 2Final
Job 3Just Started
Job 4Open

<tbody>
[TD="align: center"]1[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: center"]*** LAST ***[/TD]
[TD="align: center"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]Stat
Num
Code[/TD]
[TD="align: center"]Status
Date[/TD]
[TD="bgcolor: #FFFF00, align: center"]Current
Change
Date[/TD]

[TD="align: center"]3[/TD]

[TD="align: right"]8[/TD]
[TD="align: right"]10/21/2014[/TD]
[TD="align: right"][/TD]

[TD="align: center"]4[/TD]

[TD="align: right"]9[/TD]
[TD="align: right"]10/31/2014[/TD]
[TD="align: right"][/TD]

[TD="align: center"]5[/TD]

[TD="align: right"]6[/TD]
[TD="align: right"]9/30/2014[/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]

[TD="align: right"]4[/TD]
[TD="align: right"]10/15/2014[/TD]
[TD="align: right"][/TD]

</tbody>
Sheet1




Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("F:F")) Is Nothing Then Exit Sub
Application.EnableEvents = False
    If Target.Value <> "" Then
    If Target.Offset(, -2) < 9 Then
        Target.Offset(, -2) = Target.Offset(, -2).Value + 1
        Target.Offset(, -1) = Target.Value
    Else
    MsgBox "You have previously acheived Status 9" _
           & vbNewLine & "You Cannot Change this any longer."
    End If
    End If
Application.EnableEvents = True
End Sub
 
Upvote 0
Good morning Jim,

Thanks for this. Unfortunately the progression through the status' isn't linear. It is possible to go from 1 straight to 7 then 8, 9, 10 & 11.


Phil.
 
Upvote 0
I've modified the Sample W/B Sheet to look like so... Also replace Code with the new code below. To test Go straight to the cells D3:D6 and enter "new/updated" Status codes, such as 5,8 (other than 9). It should allow you to change and update your Status Date with today's date. Now, enter in any cell D3:D6 - 9. Doing so should date-stamp the Column F permanently with the date your proj/job's status code was changed to a 9.



Excel 2012
BCDEF
1*** LAST ***
2Job NameStatusStat Num CodeStatus DateDate Stat Code Chged to 9
3Job 1Mid-Point810/21/2014
4Job 2Final910/31/2014
5Job 3Just Started59/30/2014
6Job 4Open1010/15/2014
Sheet1


Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("D:D")) Is Nothing Then Exit Sub
Application.EnableEvents = False
    If Target.Value <> "" Then         'Deleting a Stat Num Code will have no affect
    Target.Offset(, 1) = Date
    If Target.Value = 9 Then
        Target.Offset(, 2) = Date
    MsgBox "You have acheived Status 9"
    End If
    End If
Application.EnableEvents = True
End Sub
 
Upvote 0
Looks promising Jim.

What if my "Target.Offset(, 2)" is a cell on Sheet2?

Thanks.
 
Upvote 0
we only need to locate it (the cell on Sheet2) by perhaps using match() or some other lookup method.

What sort of table setup do you have on sheet2, that I might offer a revision to the line "Target.Offset(, 2) = Date ?

Regards,

Jim
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top