+ Reply to Thread
Results 1 to 6 of 6

Re: Opening tab-delimited files in Excel... how to stop the autoformat of dates?

Hybrid View

  1. #1

    Re: Opening tab-delimited files in Excel... how to stop the autoformat of dates?

    Do a Data-->get external date-->import text files (from the main menu).

    Select the .csv file and follow the dialogue. On one screen you can see
    the formatted data. On this screen you can set the format for each
    column. Select the date column and make it text.

    Hans


  2. #2
    Pete_UK
    Guest

    Re: Opening tab-delimited files in Excel... how to stop the autoformat of dates?

    If it is a file with the extension .txt and you do File | Open within
    Excel, it will automatically take you into the Data Import Wizard where
    you can do as Hans describes. So, it might be a bit easier if you
    rename the .csv file to .txt.

    Hope this helps.

    Pete


  3. #3
    Registered User
    Join Date
    02-27-2006
    Posts
    3
    Thanks for the suggestion. Unfortunately, I should have been more clear and pointed out that I was already aware of this workaround. Because of the large volume of tab-delimited files that I deal with (I've written numerous programs that output tab-delimited files that are best viewed in Excel), manually importing each file is far from ideal. I was hoping there was a way for me to simply eliminate the date autoformatting so that I can open these files with a double-click.

    Seems hard to believe that Microsoft doesn't enable users to turn this feature off...

    Thanks for your time!

  4. #4
    Pete_UK
    Guest

    Re: Opening tab-delimited files in Excel... how to stop the autoformat of dates?

    Well, you could do it once manually and record a macro while you do it,
    setting the appropriate field to text, then in future you would only
    need to run the macro (and change the filename) to import the data how
    you want it.

    Pete


  5. #5
    Harlan Grove
    Guest

    Re: Opening tab-delimited files in Excel... how to stop the autoformat of dates?

    salamander wrote...
    >Thanks for the suggestion. Unfortunately, I should have been more clear
    >and pointed out that I was already aware of this workaround. Because of
    >the large volume of tab-delimited files that I deal with (I've written
    >numerous programs that output tab-delimited files that are best viewed
    >in Excel), manually importing each file is far from ideal. I was
    >hoping there was a way for me to simply eliminate the date
    >autoformatting so that I can open these files with a double-click.
    >
    >Seems hard to believe that Microsoft doesn't enable users to turn this
    >feature off...


    Naively, it might seem that Microsoft should provide an option to turn
    off Excel's 'helpful' features, but Microsoft is convinced such
    features are HELPFUL that their attitude towards this is SHUT UP AND
    APPRECIATE THE HELP, YOU STUPID USER.

    To the point, if you're the one generating these tab-delimited files,
    you could append an HTML nonbreaking space character (decimal character
    code 160) just after the last character of each gene token. This would
    prevent Excel from treating these tokens as dates, and they'd appear as
    you want them to. However, if you're using these files with other
    software, that software would need to strip off the nonbreaking spaces.

    Another alternative would be using a macro to unconvert these cells
    after import. The macro would search through all nonblank cells and for
    any cells containing date values, and when found convert them back into
    text. Something like

    Sub foo()
    Dim c As Range
    For Each c In Selection
    If VarType(c.Value) = vbDate Then
    c.NumberFormat = "General"
    c.Formula = "=""" & UCase(Format(c.Value, "mmmd")) & """"
    c.Copy
    c.PasteSpecial Paste:=xlPasteValues
    Application.CutCopyMode = False
    End If
    Next c
    End Sub


  6. #6
    Registered User
    Join Date
    02-27-2006
    Posts
    3
    Thanks for the excellent suggestions!

+ 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