Hi
I have a sheet where users need to enter lots of times in hh:mm:ss formatted cell. To speed up data entry I added a Worksheet change macro to replace '.' with ':', .i.e. so users can enter as hh.mm.ss.
The line that does this is:
Target.Value = Replace(Target.Value, ".", ":") ' For entering time values more easily (required time format)
However sometimes people might not follow this and still enter as hh:mm:ss, or edit a mistake after code already set initial entry to hh:mm:ss. When they do this for some strange reason this code has an unexpected and undesired effect. Say I enter 10:10:10, after the code runs it changes to 0:4237...
I have tried formatting to Target.NumberFormat = "[h]:mm:ss" but that does not help. Also I tried an If clause of where If Not(Target.Value) Like "*:*" but that doesn't seem to work properly either.
Any explanation as to what is happening and how to resolve?
Thanks, Ross
I have a sheet where users need to enter lots of times in hh:mm:ss formatted cell. To speed up data entry I added a Worksheet change macro to replace '.' with ':', .i.e. so users can enter as hh.mm.ss.
The line that does this is:
Target.Value = Replace(Target.Value, ".", ":") ' For entering time values more easily (required time format)
However sometimes people might not follow this and still enter as hh:mm:ss, or edit a mistake after code already set initial entry to hh:mm:ss. When they do this for some strange reason this code has an unexpected and undesired effect. Say I enter 10:10:10, after the code runs it changes to 0:4237...
I have tried formatting to Target.NumberFormat = "[h]:mm:ss" but that does not help. Also I tried an If clause of where If Not(Target.Value) Like "*:*" but that doesn't seem to work properly either.
Any explanation as to what is happening and how to resolve?
Thanks, Ross