I am trying to make a spread sheet to record start/stop times. I do not want my users to be able to do anything except click a button that activates the macro to do the time stamp.
If a make seperate macros to unprotect the worksheet, do the time stamp, and then protect the worksheet again, it works fine.
Sub Unprotect()
'
ActiveSheet.Unprotect Password:="123"
End Sub
Sub Time()
'
ActiveCell.Application.SendKeys ("^; ^+;~"), True
End Sub
Sub Protect()
'
ActiveSheet.Protect Password:="123"
End Sub
If I combine the commands into one macro, it doesn't work.
Sub StampTime()
'
ActiveSheet.Unprotect Password:="426"
ActiveCell.Application.SendKeys ("^; ^+;~"), True
ActiveSheet.Protect Password:="426"
End Sub
I'm not sure what else to try. I don't do much work in vb so hopefully I'm just missing something simple.
If a make seperate macros to unprotect the worksheet, do the time stamp, and then protect the worksheet again, it works fine.
Sub Unprotect()
'
ActiveSheet.Unprotect Password:="123"
End Sub
Sub Time()
'
ActiveCell.Application.SendKeys ("^; ^+;~"), True
End Sub
Sub Protect()
'
ActiveSheet.Protect Password:="123"
End Sub
If I combine the commands into one macro, it doesn't work.
Sub StampTime()
'
ActiveSheet.Unprotect Password:="426"
ActiveCell.Application.SendKeys ("^; ^+;~"), True
ActiveSheet.Protect Password:="426"
End Sub
I'm not sure what else to try. I don't do much work in vb so hopefully I'm just missing something simple.