anuradhagrewal
Board Regular
- Joined
- Dec 3, 2020
- Messages
- 87
- Office Version
- 2010
- Platform
- Windows
Hi
My file in question is BSE.csv
I am looking at repeating the first row mainly containing in all the txt files
<ticker>,<date>,<open>,<high>,<low>,<close>,<volume>,<o/i>
I have this code
What I am looking is that
1)The first row say A1-H1 be repeated in every individual files created.
2)The csv files so created be automatically be converted into *.txt files
Please help
Regards
Anu
My file in question is BSE.csv
I am looking at repeating the first row mainly containing in all the txt files
<ticker>,<date>,<open>,<high>,<low>,<close>,<volume>,<o/i>
I have this code
VBA Code:
Sub Create_Txt_File()
On Error Resume Next
myPath = "c:\test\"
Kill myPath & "*.csv" 'this will delete all that file type within that folder
On Error GoTo 0
Data = ""
For r = 2 To Cells(Rows.Count, "B").End(xlUp).Row
lcol = Cells(r, Columns.Count).End(xlToLeft).Column
For c = 1 To lcol
delim = ""
If c < lcol Then delim = ","
Data = Data & Cells(r, c) & delim
Next c
Open myPath & Cells(r, "B") & ".csv" For Append As #1
Print #1, Data
Close #1
Data = ""
Next r
End Sub
What I am looking is that
1)The first row say A1-H1 be repeated in every individual files created.
2)The csv files so created be automatically be converted into *.txt files
Please help
Regards
Anu