Sub M_snb()
sn= filter(split(createobject("scripting.filesystemobject").opentextfile("G:\OF\sample.csv").readall,vbcrlf),"dd-mm-yyyy")
cells(1).resize(ubound(sn)+1)=application.transpose(sn)
End sub
or
Sub M_snb()
open "G:\OF\sample.csv") for input as #1
sn= filter(split(Input(LOF(1), #1),vbcrlf),"dd-mm-yyyy")
close
cells(1).resize(ubound(sn)+1)=application.transpose(sn)
End sub
If transpose can't handle this (applies to both apporaches):
Sub M_snb()
with createobject("scripting.filesystemobject")
.createtextfile("G:\OF\Filtered.csv").write join(filter(split(.opentextfile("G:\OF\sample.csv").readall,vbcrlf),"dd-mm-yyyy")),vbcrlf)
end with
workbooks.open "G:\OF\Filtered.csv"
End sub
or something like (Classical ADO):
Sub M_snb()
With CreateObject("ADODB.Recordset")
.Open "SELECT * FROM `sample.csv` WHERE [DrillingDate] <12/01/1980", "Driver={Microsoft Text Driver (*.txt; *.csv)};" & "Dbq=G:\downloads\", adOpenStatic ' 3
Cells(1).CopyFromRecordset .DataSource
End With
End Sub