VB Script for a time stamp

steve2115

Board Regular
Joined
Mar 17, 2014
Messages
82
Need help with a vb script to put a time stamp on excel sheet based off criteria being reached

Cell C5 formula is =SUM($E$9:$E$60)/C1 This is a calculated field. It determines the % complete.

I would like to put a 'time stamp' in Cell F6 when Cell C5 is > or = to 90%.
However, if cell C5 hits the 90% mark but it was a user entry error. I would like the time stamp to be removed if Cell C5 is < 90% after corrected entry is made.

Any help would be greatly appreciated.

Thanks in advance.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Welcome to the forum. You will find much knowledge here.

Try this worksheet function.
Code:
Private Sub Worksheet_calculate()
 
Application.EnableEvents = False
If Cells(5, 3) >= 0.9 And Cells(6, 6) = "" Then
    Cells(6, 6) = Now
ElseIf Cells(5, 3) < 0.9 Then
    Cells(6, 6) = ""
End If
Application.EnableEvents = True
End Sub
 
Upvote 0
We can use this also

Private Sub Worksheet_Change(ByVal Target As Range)


If Not Intersect(Target, Range("C5")) Is Nothing Then
Application.EnableEvents = False
If Target.Value >= 90 Then

Range("F6").Value = Now()
Else
Range("F6").ClearContents
End If
Application.EnableEvents = True
End If


End Sub
 
Upvote 0
please try this not above
Private Sub Worksheet_calculate(ByVal Target As Range)


If Not Intersect(Target, Range("C5")) Is Nothing Then
Application.EnableEvents = False
If Target.Value >= 90 Then

Range("F6").Value = Now()
Else
Range("F6").ClearContents
End If
Application.EnableEvents = True
End If


End Sub
 
Upvote 0
C5 is not changing. C5 is a formula. (I tried this first)

Also 90% is .9 You need to know what the actual numbers being summed is to know if you want to test against 90 or .9
 
Upvote 0
The calculate sent does not get a target.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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