Excel

[Closed]
Report
-
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
-
Hello,
i am working about ime sheat,i always i have to put the ( : ) in each time i have to do so many or this is possible to set time without put ( : ), eg:- 03:45 i need to set this time like that 345 and this should be change directly 3:45
please help me

2 replies

Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
803
Obviously the
se time entries are made in a particular column 

suppose that column is A(column no. 1)
In that case
right click the sheet tab and click view code
in the window that pops up copy this event code

Private Sub Worksheet_Change(ByVal Target As Range)
Dim vvalue
Application.EnableEvents = False
On Error GoTo exiting
If Target.Column <> 1 Then Exit Sub
vvalue = ((Left(Target, Len(Target) - 2) & ":" & Right(Target, 2)))
Target.Clear
Target.Value = vvalue
exiting:
Application.EnableEvents = True
End Sub


save the file

and now type 345 in any cell in column A see what happens

if the time entry is not in column A then the statement in the code
If Target.Column <> 1 Then Exit Sub
may be changed into
if target.column<>(the correct column number) then exit sub

then again test the code by entering in that column some number like 345

I am sure you an modify the code like this if necessary.

post confirmation whether this is ok
Posts
8926
Registration date
Friday May 15, 2009
Status
Member
Last seen
October 7, 2010
2,108
hi there,

what is the office version thet you are using?

please give more information

Thanks
Posts
1864
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
803
windows xp excel 2002