+ Reply to Thread
Results 1 to 12 of 12

Date Converting Incorrectly HELP!

  1. #1
    Registered User
    Join Date
    11-06-2006
    Posts
    6

    Date Converting Incorrectly HELP!

    Hi All,

    I have a .csv file that has a column of data that consist of 10-24 in each cell. When I open the .csv file in excel, it automatically converts its to 24-Oct. Is there a way for me to tell excel to open a file without any conversion?

    The version of excel is 2000.

    Thanks.


    Matt

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Rename your file to something other than .csv (.txt is nice). Then when you
    open it, xl will recognize it as text and show the text to columns wizard. You
    can specify this field as Text--don't leave it General.

    (If you have to do this over and over, you might want to record a macro when you
    do it once. Then you could run this macro instead of doing it manually.)


    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    11-06-2006
    Posts
    6
    << Rename your file to something other than .csv (.txt is nice). >>

    I tried that, and excel took all 10 of my seperate columns and put them into one column. I don't want my columns compressed down to one column.

    Thanks.

    Matt

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Use text to Columns and delimter is space

    VBA Noob

  5. #5
    Registered User
    Join Date
    11-06-2006
    Posts
    6
    << Use text to Columns and delimter is space >>

    Once the file is open in excel, the damage is done. The cell is converted to a date. I'm trying to come up with a solution for my end users because they don't want to do anything manually. They want the data to appear as it appears in the text file without any converting from excel, and they still want to be able to sort by different columns. Is there a way to tell excel to open the file as is, without any conversion?

    Thanks.

    Matt

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Did you try formatting the cells first as Text

    VBA Noob

  7. #7
    Registered User
    Join Date
    11-06-2006
    Posts
    6
    << Did you try formatting the cells first as Text >>

    I don't think this would work either, because my users just want to open the .csv file from excel and have nothing change. If the cell is formated as text first, then I would have to paste the contents in correct?

    Matt

  8. #8
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    The only thing I can think of is change the file extension to .txt and then open in Excel, which this will trigger the import wizard, select delimter and o the next screen you will then have the option of selecting the cell that looks like a date and specify that particular column to be imported as text not as a date. Thing it's the third option down

    VBA Noob

  9. #9
    Registered User
    Join Date
    11-06-2006
    Posts
    6
    The import wizard you talked about. I never see that come up. When I click on the .csv file excel just opens it up automatically, and does the conversion. How can I get the import wizard to come up?

    Thanks.

    Matt

  10. #10
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Right click the file. Change open with from excel to say notepad. Then open the notepad file and over type the .csv to .txt and save as a new file.

    When you open the .txt file it will give you the wizard. The last step in the wizard gives you the option to select the column and enter as text

    VBA Noob

  11. #11
    Registered User
    Join Date
    11-06-2006
    Posts
    6
    Okay, I see the wizard converted each cell to text instead of general. But again, this is still an manual step for my users who want this to be automated. So, I guess my next question is, can this be done using something like Office SDK?

    Thanks.

    Matt

  12. #12
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Right,

    Try this

    Start the macro record then record

    Data > Import External Data >Import Data
    Select the .csv file, and follow the prompts of the Import Wizard format the column to text.

    Modify the macro as required. Note to use the macro again always name the.csv file the same and needs to be in the same path

    If that doesn't work then you will need to ask a VBA expert

    VBA Noob

+ 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