View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Macro to edit time on worksheet

Sub AA()
For Each cell In Selection
If cell.Text Like ":##" Then
sStr = "0" & cell.Text
cell.NumberFormat = "h:mm"
cell.Value = sStr
End If
Next

End Sub


worked for me.

If you sum up the cells using the sum formula, make sure you format the sum
cell as a Time format.

--
Regards,
Tom Ogilvy



wrote in message
oups.com...
Hello,

I'm attempting to create a macro that either appends to a time or
converts the value. Basically, I would like the macro to check the
worksheet for times in a particular format, such as:

:34
:45
:21
:00

This format does not allow me to add their values to create a total
time. What I would like to do is create a macro that will check for
values that are in this format, convert them to a 0:mm format (where
'mm' is the value of the time that was in there originally). Thanks for
the help.

Jason