+ Reply to Thread
Results 1 to 5 of 5

Macro Search+Replace Error

  1. #1
    Registered User
    Join Date
    05-26-2010
    Location
    Antartica
    MS-Off Ver
    Excel 2003
    Posts
    3

    Macro Search+Replace Error

    Hi everyone, I used the record button in excel 2003 create a macro that will replace all the" 03:" in a selection into "00:03:", the same with 2,4,5,6 and then remove the last ":00" (the format is xx:xx:00).
    Because the time was seen as hours instead of minutes.
    I used this code:
    Please Login or Register  to view this content.
    Eg: 03:16:00 should become 00:03:16.
    But it doesn't do anything, how so?
    Sometimes it even adds AM to the end.
    Thank you very much in advance.
    Last edited by DoodleExcel; 05-26-2010 at 04:49 PM.

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Macro Search+Replace Error

    Perhaps your problem has more to do with the cell formatting than the values. Try highlighting those cells, then right click and go to Format Cells... On the Number tab, pick an appropriate type for how you want the data to look.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Registered User
    Join Date
    05-26-2010
    Location
    Antartica
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Macro Search+Replace Error

    Thank you for the quick reply, my formatting for these cells are :
    Please Login or Register  to view this content.
    I copy data from iTunes, and then use formulas to tell me information about it, but in excel the formatting is eg. 03:16:00, the first part being the minutes, then seconds, and then 'don't ask me why) but micro seconds. If you could show me how to do a better formatting it would also be great

    Oh yeah, i'm not sure if the last :00 are already there in iTunes or if excel just adds them

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Macro Search+Replace Error

    Use the Custom number format:

    Please Login or Register  to view this content.
    This is in the Custom list included with excel.
    Isn't that the format you are looking for?

  5. #5
    Registered User
    Join Date
    05-26-2010
    Location
    Antartica
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Macro Search+Replace Error

    That solves the problem if I use the format
    Please Login or Register  to view this content.
    (because the :00 is still at the end), thank you.
    But then my formulas are screwed up since it should be in minutes.
    Can you create a custom format like hh:mm and choose when it "changes" like after 60 minutes you have 1 hour?
    But instead be seconds.
    Last edited by DoodleExcel; 05-27-2010 at 01:32 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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