Hi,
I have issue with CSV file, I don't know how to exactly explain it but I will try my best
I'm generating CSV file in different tool and it looks like below:
and after that I'm using macro in different excel sheet:
and now is the moment where I have a issue... when I will open CSV file and I will save it(ctrl+s) and close the file
my macro will work and I will get the results:
but when I will not open CSV file that has been generated by tool, I will get results:
It sees it as 1 line but truly in excel sheet
it's all in different rows.
Can I somehow fix it, I know that it's not a big deal but I need sometimes to open 200 csv files
Thank you,
I have issue with CSV file, I don't know how to exactly explain it but I will try my best
I'm generating CSV file in different tool and it looks like below:
word1,word2,word3,word4,word5,word6 | |
word1,word2,word3,word4,word5,word6 | |
word1,word2,word3,word4,word5,word6 | |
word1,word2,word3,word4,word5,word6 | |
and after that I'm using macro in different excel sheet:
VBA Code:
Sub Makro2()
Dim fd1 As Office.FileDialog
Set fd1 = Application.FileDialog(msoFileDialogFilePicker)
With fd1
.Filters.Clear
.Title = "Select a CSV File"
.Filters.Add "CSV", "*.csv"
.AllowMultiSelect = False
Dim sFile1 As String
If .Show = True Then
sFile1 = .SelectedItems(1)
End If
End With
If sFile1 <> "" Then
Open sFile1 For Input As #1
row_number1 = 1
Do Until EOF(1)
Line Input #1, LineFromFile1
LineItems1 = Split(LineFromFile1, ",")
For I = 0 To UBound(LineItems1) Step 1:
Range("A1:F1").Cells(row_number1, I + 1).Value = LineItems1(I)
Next I
row_number1 = row_number1 + 1
Loop
Close #1
End If
End Sub
and now is the moment where I have a issue... when I will open CSV file and I will save it(ctrl+s) and close the file
my macro will work and I will get the results:
word1 | word2 | word3 | word4 | word5 | word6 |
word1 | word2 | word3 | word4 | word5 | word6 |
word1 | word2 | word3 | word4 | word5 | word6 |
word1 | word2 | word3 | word4 | word5 | word6 |
but when I will not open CSV file that has been generated by tool, I will get results:
word1 | word2 | word3 | word4 | word5 | word6 | word1 | word2 | word3 | word4 | word5 | word6 | word1 | word2 | word3 | word4 | word5 | word6 | word1 | word2 | word3 | word4 | word5 | word6 |
It sees it as 1 line but truly in excel sheet
it's all in different rows.
Can I somehow fix it, I know that it's not a big deal but I need sometimes to open 200 csv files
Thank you,