Private Sub Workbook_Open()
Range("A1").NumberFormat = "hh:mm"
Range("A1").Formula = "=Now()-Today()"
Range("B1").Formula = "=Text(A1,""hhmm"")"
Range("B1").Value = "'" & Range("B1").Value
Range("A1").NumberFormat = "@"
Range("A1").Value = Range("B1").Value
Range("B1").ClearContents
End Sub
Private Sub Workbook_Open()
If Sheets("Sheet1").Range("A1") <> vbNullString _
Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
With Sheets("Sheet1").Range("A1")
.NumberFormat = "0"
.Value = Format(Now(), "HHMM")
End With
CleanUp:
Application.EnableEvents = True
End Sub
Am I supposed to right click the tab button and insert into view code? I cannot seem to find "Thisworkbook module" so am not sure what I am doing wrong or where to put the code listed from the three results. The best I can do is normally run the macro recorder and the odd time modify some of that stuff but am not so adept at working with vba code.