I created a machine performance audit sheet where every time a machine stops and restarts the user has to input the time of the stop and time of the restart of the machine in cells.
The formulas (more than in the image above) work well if all the time cells have the same format (hh:mm:ss).
For users who don't want to enter time manually I made this macro (CRTL-T) :
Sub InsertTime()
'
' InsertTime Macro
' Insert current time
'
' Keyboard Shortcut: Ctrl+t
'
ActiveCell.FormulaR1C1 = "=NOW()"
ActiveCell.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
So far so good ... but the issue I have now is that people in our company have different language and time format on their laptop. Because of that the macro does not always inserts a time stamps with the hh:mm:ss time format, when that happens the formulas don't work properly.
QUESTIONS for the board :
1- what can I add to the macro to make sure the time entered in the cell is in format hh:mm:ss (military time like 2:00:00 or 14:00:00) ? Without changing the regional settings in Windows/Excel.
I assume I can do paste the NOW time according to a format set in the macro itself while not changing regional settings.
2- how can I restrain the use of the macro to only cells B28:C227 and D11:E12 ?
Thanks for the help.
The formulas (more than in the image above) work well if all the time cells have the same format (hh:mm:ss).
For users who don't want to enter time manually I made this macro (CRTL-T) :
Sub InsertTime()
'
' InsertTime Macro
' Insert current time
'
' Keyboard Shortcut: Ctrl+t
'
ActiveCell.FormulaR1C1 = "=NOW()"
ActiveCell.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
So far so good ... but the issue I have now is that people in our company have different language and time format on their laptop. Because of that the macro does not always inserts a time stamps with the hh:mm:ss time format, when that happens the formulas don't work properly.
QUESTIONS for the board :
1- what can I add to the macro to make sure the time entered in the cell is in format hh:mm:ss (military time like 2:00:00 or 14:00:00) ? Without changing the regional settings in Windows/Excel.
I assume I can do paste the NOW time according to a format set in the macro itself while not changing regional settings.
2- how can I restrain the use of the macro to only cells B28:C227 and D11:E12 ?
Thanks for the help.