I have a problem opening the .csv file programmatically. A file is a temporary series of daily data with several data points associated with each date.
When I manually open the file, the dates open correctly as the date format dd/mm/yyyy. However, when I open the file programmatically, the dates until the 12th day of each month open as mm/dd/yyyy, although the format remains dd/mm/yyyy(for example, July 1, 1983 (1/7/1983), it will open as January 7, 1983 (7/1/1983) - it’s not just a formatting issue, Julian’s date (days from January 1, 1901) associated with these dates also changes), and the dates after the 12th of every month open correctly, although as text, not dates.
Data in the form of text is not a problem, but changing the date the file is opened is problematic. I could try to import the entire CSV file as comma-delimited text rather than opening the file, however it would be easier and faster if I could stop changing dates when opening the file.
Has anyone had a similar problem with this in the past? Any advice on this would be greatly appreciated. Hello Ben.
Flder = InputBox("Copy and Paste Folder path here:")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set SourcePath = FSO.GetFolder(Flder)
For Each File In SourcePath.Files
Workbooks.Open (File)
FlNm = File.Name
StrtCol = Workbooks(FlNm).Worksheets(1).Range(Cells(4, 1), Cells(4, 30)).Find ("Mean").Column
Workbooks(FlNm).Worksheets(1).Range(Cells(1, 1), Cells(60000, 1)).Copy (Workbooks("Find Water Years V2.xls").Worksheets(1).Range("A3"))
Workbooks(FlNm).Worksheets(1).Range(Cells(1, StrtCol), Cells(60000, StrtCol + 1)).Copy (Workbooks("Find Water Years V2.xls").Worksheets(1).Range("B3"))
Workbooks(FlNm).Close
Next
The problem occurs in the line Workbooks.Open (File). Sorry to not throw this away for starters.