+ Reply to Thread
Results 1 to 4 of 4

Macro to edit time on worksheet

  1. #1
    jeehtoven@gmail.com
    Guest

    Macro to edit time on worksheet

    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


  2. #2
    Tom Ogilvy
    Guest

    Re: 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



    <jeehtoven@gmail.com> wrote in message
    news:1125178997.265655.235490@f14g2000cwb.googlegroups.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
    >




  3. #3
    jason.banks
    Guest

    Re: Macro to edit time on worksheet

    Worked like a charm...thanks for your help. Do you know any good sites
    for advanced macro tutorials?


  4. #4
    Tom Ogilvy
    Guest

    Re: Macro to edit time on worksheet

    Tutorials, no. But there are plenty of sites with Advanced code.

    Go to John Walkenbach's site and look at his links page (and his site as
    well)

    http://www.j-walk.com/ss/excel

    --
    Regards,
    Tom Ogilvy


    "jason.banks" <jeehtoven@gmail.com> wrote in message
    news:1125250807.637421.230130@g47g2000cwa.googlegroups.com...
    > Worked like a charm...thanks for your help. Do you know any good sites
    > for advanced macro tutorials?
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1