error-messaging

Protect non-empty cells VBA

删除回忆录丶 提交于 2019-11-29 16:06:53
I've added VBA code which will insert either the time or date to a cell upon double clicking. I managed to get that going pretty well. The bit I'm struggling with is getting the cell to protect and lock after the time/date has been entered. I've got to a point where when I double click/try to edit a non-empty cell, I get a runtime error. Upon debugging, the line that throws me up is "Target.Formula = Format(Now, "ttttt")" . I'm also not able to throw an error message either. I'm so close! Any advice would be truly appreciated! My code: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As

Protect non-empty cells VBA

旧时模样 提交于 2019-11-28 09:45:01
问题 I've added VBA code which will insert either the time or date to a cell upon double clicking. I managed to get that going pretty well. The bit I'm struggling with is getting the cell to protect and lock after the time/date has been entered. I've got to a point where when I double click/try to edit a non-empty cell, I get a runtime error. Upon debugging, the line that throws me up is "Target.Formula = Format(Now, "ttttt")" . I'm also not able to throw an error message either. I'm so close! Any