Results 1 to 3 of 3

Locating sections of time value using vba.

Threaded View

  1. #1
    Registered User
    Join Date
    04-07-2008
    Location
    Adelaide, SA
    Posts
    87

    Locating sections of time value using vba.

    Hi all,

    I have been trying to locate parts of a time value and have those parts adjusted to a suitable format.

    The problem is, the time value is written in a number of ways. These are all the possible ways they are written:

    1-09.30
    1-09.3
    1-9.30
    1-9.3

    1:09.30
    1:09.3
    1:9.30
    1:9.3

    1-09-30
    1-09-3
    1-9-30
    1-9-3

    These examples are all the same value, just written differently.

    What I am trying to achieve is for all times to end up looking like the 1st example "1-09.30". So for the example "1-9.30", I need a "0" added in front of the "9". For the example "1-9.3", I need a "0" put in front of the "9", and a "0" put after the "3".

    The seperating characters "-" "." ":" can be any combination of the 3.

    I've used this code which works for the 2nd time example, but obviously not for the 3rd and 4th examples.

    If Len(t) = 6 Then t = t & 0
    hope someone can help?

    Thanks,

    Yappa
    Last edited by Yappa; 07-29-2008 at 01:13 PM.

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