Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Formatting for time

I have number in E3 (300) in column P I have the formula
=TEXT((TIME(,,E3)),"mm:ss") which nicely converts it to 5:00 or 5 minutes 299
= 4:59 etc.

what I an trying to do is eliminate column P and use a target formula so
that when the number is typed in E it converts it programatically. I did this
for converting to upper case and was using it as a base for this but I'm not
sure of the syntax for the target.formula:

If Target.Column = 1 Then Exit Sub
If Target.Row = 1 Then Exit Sub
If Target.Column = 5 Then
On Error Resume Next 'insure that Enable Events gets reenabled
Application.EnableEvents = False
'Target.Formula = UCase(Target.Formula)
Target.Formula = Text("mm:ss")
Application.EnableEvents = True
On Error GoTo 0
End If

If Target.Column = 2 Then
On Error Resume Next 'insure that Enable Events gets reenabled
Application.EnableEvents = False
'Target.Formula = UCase(Target.Formula)
'Target.Formula = Text((Time(, , E3)), "mm:ss")
Target.Formula = Text("mm:ss")
Application.EnableEvents = True
On Error GoTo 0
End If


End Sub

I may be way off base but any suggestions or revisions or anything would be
greatly appreciated. Cheers
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,358
Default Formatting for time

I would recommend taking a look at Chip Pearson's page.
http://www.cpearson.com/excel/DateTimeEntry.htm

And modify as needed
--
** John C **

"Dan" wrote:

I have number in E3 (300) in column P I have the formula
=TEXT((TIME(,,E3)),"mm:ss") which nicely converts it to 5:00 or 5 minutes 299
= 4:59 etc.

what I an trying to do is eliminate column P and use a target formula so
that when the number is typed in E it converts it programatically. I did this
for converting to upper case and was using it as a base for this but I'm not
sure of the syntax for the target.formula:

If Target.Column = 1 Then Exit Sub
If Target.Row = 1 Then Exit Sub
If Target.Column = 5 Then
On Error Resume Next 'insure that Enable Events gets reenabled
Application.EnableEvents = False
'Target.Formula = UCase(Target.Formula)
Target.Formula = Text("mm:ss")
Application.EnableEvents = True
On Error GoTo 0
End If

If Target.Column = 2 Then
On Error Resume Next 'insure that Enable Events gets reenabled
Application.EnableEvents = False
'Target.Formula = UCase(Target.Formula)
'Target.Formula = Text((Time(, , E3)), "mm:ss")
Target.Formula = Text("mm:ss")
Application.EnableEvents = True
On Error GoTo 0
End If


End Sub

I may be way off base but any suggestions or revisions or anything would be
greatly appreciated. Cheers

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting time Joe Excel Discussion (Misc queries) 6 February 16th 09 11:28 PM
Time formatting hh:mm:ss Dallman Ross Excel Discussion (Misc queries) 6 May 21st 08 12:30 AM
time formatting Wanna Learn Excel Discussion (Misc queries) 2 July 27th 07 06:48 PM
time formatting and time categorizing (vlookup or data validation) MarianneR Excel Worksheet Functions 4 November 18th 04 03:24 PM
time formatting and time categorizing (vlookup or data validation) MarianneR Excel Worksheet Functions 0 November 18th 04 03:13 PM


All times are GMT +1. The time now is 04:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"