+ Reply to Thread
Results 1 to 13 of 13

Multiple Date Conversions using VBA

  1. #1
    Registered User
    Join Date
    10-29-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    49

    Multiple Date Conversions using VBA

    I have a set of data I'd like to manipulate- the only problem is that there are two date formats in the set. The formats are in this form:

    Thursday 18th September 2013
    Sat 15th Jun

    The column format is set to general- I've tried to switch it to text or date via "format cells" but that doesn't change it. I've even tried multiplying the cells by 1 in a different column and converting to text but that doesn't work either

    Is there a code for converting the date formats? Specifically to dd/mm/yyyy.

  2. #2
    Registered User
    Join Date
    04-22-2013
    Location
    The Netherlands
    MS-Off Ver
    Excel 2003/2007 & 2010
    Posts
    90

    Re: Multiple Date Conversions using VBA

    Post your workbook so we can see.

  3. #3
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Multiple Date Conversions using VBA

    If the dates are "real" excel dates then yes.....Format(NOW(), "dd/mm/yyyy") and assign that to a variable...remember that changing the formatting on an excel cell doesn't change the value, just how it is presented....you can verify if they are real dates by going to a blank cell and typing.....=ISNUMBER(A1).....this should return a TRUE if is a real excel date....if it is not let us know and we'll have a take a different tack....HTH
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  4. #4
    Registered User
    Join Date
    10-29-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Multiple Date Conversions using VBA

    Column "A" is the one with the multiple date formats. I'd like to filter them into the dd/mm/yyyy format so I can delete all the fixtures that kick-off a week from any given date.
    Attached Files Attached Files

  5. #5
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Multiple Date Conversions using VBA

    so that makes it tough because the dates aren't real....also, is this the entrire dataset?....because it doesn't have the year in some of the cells....should we assume that the year is 2013?

  6. #6
    Registered User
    Join Date
    10-29-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Multiple Date Conversions using VBA

    Quote Originally Posted by judgeh59 View Post
    so that makes it tough because the dates aren't real....also, is this the entrire dataset?....because it doesn't have the year in some of the cells....should we assume that the year is 2013?
    Yeah the dates are all in 2013. And they aren't real

  7. #7
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Multiple Date Conversions using VBA

    and you want to do this in VBA/Macros not formulas?

  8. #8
    Registered User
    Join Date
    10-29-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Multiple Date Conversions using VBA

    Ideally yes, because I'd also like to delete the rows which only have the date and nothing else (i.e. cell B,C and D) are empty. I am still a beginner at VBA and am trying to find a solution

  9. #9
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Multiple Date Conversions using VBA

    this converts your dates to real dates and then you can format them to the "dd/mm/yyyy"

    Please Login or Register  to view this content.

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Multiple Date Conversions using VBA

    This formula will convert the dates in column A to 'real' dates.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    You can delete the blank rows by selecting columns B, C and D, Find & Select>Goto Special...Blank Cells..., right clicking one of the blank cells, selecting Delete... and then Entire Rows.
    If posting code please use code tags, see here.

  11. #11
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Multiple Date Conversions using VBA

    Bump.....did we fix your issue?

  12. #12
    Registered User
    Join Date
    10-29-2012
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: Multiple Date Conversions using VBA

    Quote Originally Posted by judgeh59 View Post
    Bump.....did we fix your issue?

    Hi judgeh59, yes it has been fixed indeed- sorry was just playing around with your code and trying to delete the blank cells before I replied. But yes, the initial prolem has been solved, thanks very much!

  13. #13
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Multiple Date Conversions using VBA

    great, glad I could help....also, being a new person to the group...it is recommended that you set your post to solved by using the Thread tools...and forum ettiquette recommends that if you feel so inclined to click on the star in the lower left, this bumps the reputation points of the helper...and someday when you help somebody they'll bump your reputation....have a great day....

+ 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