timestamp whem cell changes by formula

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
This is the formula i'm using:

=ALS(ISFOUT(=VERT.ZOEKEN($L$16;E2:H2;4;0));" ";=VERT.ZOEKEN($L$16;E2:H2;4;0))

I'll explain the purpose for you:
I'm a teacher and when the students hand in there exames, we have to (by law) write down the time they hand it over. So i'm trying to make it easier by having al the studends numbers in an excel sheet. When i enter there studentnumber, something is written down in A1. I hope to automaticly get a time stamp there.

Sorry for my bad English... I'm from the Netherlands
 
Upvote 0
So a macro can be made where if you enter a student number in say column B, then the macro will automatically put a time stamp in column A. The macro actually time stamps your student number entry and not the formula calculating.

To install the macro:
  • Right-click on the sheet tab
  • Select View Code from the pop-up context menu
  • Paste the code from below in the Worksheet's code module
  • Change the B:B to the column of cells you change (not the formula column).

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count = 1 Then
        If Not Intersect(Target, Range("[B]B:B[/B]")) Is Nothing Then
            If Target.Value <> "" Then Target.Offset(0, -1).Value = Now
        End If
    End If
End Sub
 
Upvote 0
You might add an Else statement to BEEP or have a message box to point out there was already a value in "A"
 
Upvote 0
Thanks, for your answer, it works, but when I enter the studens number, I always enter it in Cell L16, then vertical search finds the right student. So it is important that the timestamp displays when the cell with the formula is updated.
 
Upvote 0
Thanks, for your answer, it works, but when I enter the studens number, I always enter it in Cell L16, then vertical search finds the right student. So it is important that the timestamp displays when the cell with the formula is updated.

Both the formula and the macro code simultaneously update when you enter a value.

Do you enter student numbers in column L and have formulas in column B and want a time-stamp in column A?
 
Upvote 0
Yes like that, I only changed the sheet a little sinds this morning. The formula is in column F, I want the timestamp in Column G, and i enter the studentsnumers in cell L1.

Really hope you can help me!
 
Upvote 0
Found it:

Private Sub Worksheet_Calculate()
Dim r As Range
For Each r In Intersect(Range("F:F"), ActiveSheet.UsedRange)
If r.Value = 1 And r.Offset(0, 1).Value = "" Then
Application.EnableEvents = False
r.Offset(0, 1) = Time
Application.EnableEvents = True
End If
Next r
End Sub


Thanks for your help!
 
Upvote 0

Forum statistics

Threads
1,215,332
Messages
6,124,314
Members
449,153
Latest member
JazzSingerNL

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