Automatic time conversion in the SAME cell
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A4" '<=== change to suit
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If IsNumeric(.Value) Then
If .Value < 1 Then
If .Value = TimeSerial(6, 0, 0) Then
.Value = .Value - TimeSerial(6, 0, 0)
Else
.Value = .Value + 1 - TimeSerial(6, 0, 0)
End If
End If
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"Megs" wrote in message
...
Hi,
If I key in the time "9:00:00 AM" in cell A4 and press the enter key, I
wanted cell A4 to display "3:00:00 AM". If this is possible, please tell
me
the detailed procedure.
For your information, "9:00:00 AM" is the U.S. time, once I entered the
time excel in cell A4 for example, it should automatically become "3:00:00
AM" in German time in the SAME A4 cell.
Thanks in advance.
Regards,
Megs
|