sassriverrat
Well-known Member
- Joined
- Oct 4, 2018
- Messages
- 655
Hello- So I have three Macros that create sheets- Macro 1 creates "Noon" or Sheet1. Macro 2 creates "Noon#" which is essentially a copy of "Noon" and whatever number and can be near infinite. Macro 3 creates "Arrival" which is the summation of the info from all of the noons. Anyway, I wrote a timestamp piece a while ago that worked pretty well- I had to run EnableEvents before it would work which was odd and then disable again- not sure why, but othewise it worked. It was copied to each worksheet. Now with the macros creating new sheets on demand, I'd like a way to add it into the three macros. It's purpose it to create a timestamp that WON'T update when the workbook is reopened. Thanks for the help!
-Side note- when it was assigned to the individual sheets, I had a Sub ddd (application.EnableEvents) right before using the worksheet EACH time (even through it was in the workbook open sheet) to make my coding below work. It's elementary and maybe someone has something better.
Code Note- Yes it is designed that if something is entered into "R8" it puts a timestamp in F4. R8 is a data cell. If a date (a manual override) is put "W25", that date will showup to override the timestamp.
-Side note- when it was assigned to the individual sheets, I had a Sub ddd (application.EnableEvents) right before using the worksheet EACH time (even through it was in the workbook open sheet) to make my coding below work. It's elementary and maybe someone has something better.
Code Note- Yes it is designed that if something is entered into "R8" it puts a timestamp in F4. R8 is a data cell. If a date (a manual override) is put "W25", that date will showup to override the timestamp.
Code:
Private Sub Worksheet_Change(ByVal Target As Range) With Application
.EnableEvents = False
.ScreenUpdating = False
End With
If Not Intersect(Target, Range("R8,W25")) Is Nothing Then
If Cells(8, 18) <> "" And Cells(25, 23) = "" Then
Cells(4, 6) = Date
Cells(4, 6).NumberFormat = "dd-mmm-yyy"
End If
If Cells(25, 23) <> "" Then
Cells(4, 6) = Cells(25, 23).Value
Cells(4, 6).NumberFormat = "dd-mmm-yyy"
End If
If Cells(8, 18) = "" And Cells(25, 23) = "" Then
Cells(4, 6) = "No Data Input"
End If
If Cells(20, 26) = "'Yes" Then
Cells(9, 18) = "'Exact"
End If
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End If
End Sub