+ Reply to Thread
Results 1 to 6 of 6

Number store as text & text date with 2 digit year problem

  1. #1
    Registered User
    Join Date
    12-04-2008
    Location
    Penang, Malaysia
    Posts
    23

    Number store as text & text date with 2 digit year problem

    Hi there,

    I have a macro which will import data to the worksheet, then perform some formatting on the data, then assign the month & job description based on the lookup table.

    The problem is that when I import in the data, the data in column B&C will be store as text instead of number and the date in column E will store a 2 digit year instead on 4 digit year which cause error to my macro. I have try to preset the column format to number, i even try to change the column format to number when i run the format macro data. But the problem is still there.

    Is there something missing in my code?


    I attach here with the my workbook for reference.

    Thanks!!
    Attached Files Attached Files
    Last edited by obc1126; 12-24-2008 at 01:23 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    Highlight the date cells. Click on Data > Text to Columns > Next > Next > Column Date = Date: MDY > Finish

    Voila.

    You can add that step right into your import macro to fix it on the fly.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 12-23-2008 at 11:26 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387
    JBeaucaire,

    Nicely done.

    We can always learn something new.


    Have a great day,
    Stan
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    If that takes care of your need, be sure to EDIT your original post (Go Advanced) and mark the PREFIX box [SOLVED]

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525
    Hi there,

    If you replace (or comment out) these lines of code in the FormatData macro...

    Please Login or Register  to view this content.
    ...with this

    Please Login or Register  to view this content.
    your procedure should run fine - note though that the dates in the range E49 to E55 are not in your lookup table in the Info tab.

    HTH

    Robert

  6. #6
    Registered User
    Join Date
    12-04-2008
    Location
    Penang, Malaysia
    Posts
    23
    Thanks JBeaucaire & Robert.

    This solved the date format issue. I have made some adjustment on Robert code and the issue on column B&C are also solved.

    Millions thanks to you all.

    Merry Christmas & Happy New Year.



+ 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