Results 1 to 8 of 8

.csv file. Different when opened manually and via VBA

Threaded View

  1. #1
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    .csv file. Different when opened manually and via VBA

    Hi,Can anyone suggest what's going on here with the attached file.Opening it manually the dates in column C are all consistently date numbers. i.e. using the =ISNUMBER() function to test them, they all return True
    However when I include the VBA instruction:
    Workbooks.Open Filename:="C:\fileopentest.CSV"
    to open the same file, the dates are a mixture of date numbers and what appear to be text since some return the value FALSE

    However I think they are still date numbers since when I use say
    =Left(c10,2) to extract the '01' which is actually month 1 January, I get the result 40, which is in fact the 40 from the number 40026, which of course implies it is a date, albeit it the wrong one, i.e. 1st Aug 2009 not 8th Jan 2009.
    This file originates from Quick Books if that helps and I'm using Excel 2007.
    My problem is that since the 'dates' are inconsistent I can't rely on being able to filter them.So.. two questions.

    1. Why does the file open manually with all dates consistently proper dates, yet when opened with a macro they are different.


    2. Can anyone suggest why these dates are inconsistent and how they could be manipulated to consitent date numbers.


    I'm fast disappearing up my own backside with this!


    Usual TIA
    Attached Files Attached Files
    Last edited by Richard Buttrey; 01-22-2009 at 09:41 AM.

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