Hey guys!
I have a csv file like this.
2012-09-10 meat spaghetti
2012-09-11 fish fish and chips
2012-09-12 meat hamburger
etc.
etc.
and I want to read it and write it to excel. So far I have come with my code but I'm stuck. so I wonder if anyone has some tips or can help me?
I was thinking like this. to read the file size, then put it in a string$ after that i split it up that meat is in sheets1 and fish in sheets2 and salad in sheet3. and cell 1 get the date and cell 2 get the meat and cell 3 get the spaghetti.
so heres my code
sorry i'm new in vba.
thanks in advance
I have a csv file like this.
2012-09-10 meat spaghetti
2012-09-11 fish fish and chips
2012-09-12 meat hamburger
etc.
etc.
and I want to read it and write it to excel. So far I have come with my code but I'm stuck. so I wonder if anyone has some tips or can help me?
I was thinking like this. to read the file size, then put it in a string$ after that i split it up that meat is in sheets1 and fish in sheets2 and salad in sheet3. and cell 1 get the date and cell 2 get the meat and cell 3 get the spaghetti.
so heres my code
Code:
Sub ImpFile()
Dim ws As Worksheet, iFileNo As Integer
Dim s1 As String, s2 As String
Set ws = ThisWorkbook.Worksheets("sheets1")
s2 = "sampel.csv"
iFileNo = FreeFile()
Open s2 For Binary As #iFileNo
s1 = String$(FileLen(s2), 0)
------i'm stuck here------
Close #iFileNo
End Sub
sorry i'm new in vba.
thanks in advance
Last edited: