My first answer here was almost perfect. https://excelfox.com/forum/showthrea...ll=1#post13185
https://excelfox.com/forum/showthrea...ll=1#post13184
This was your question:
i have three files 1.xls & 2.csv & 3.xlsx
1.xls first row has headers so dont count that
In 1.xls count the total number of rows that has data and copy the 3.xlsx sheet3 first row(first complete row copy) and paste that much time of 3.xlsx first row of sheet3 to 2.csv
suppose 1.xls has data in 5 rows then copy 3.xlsx first row of sheet3 and paste it to 2.csv 5 times
all files are located in a different path
sheet name can be anything
This question should have been you question:
VBA To Copy Rows From One Workbook To text csv File, Based On Count In A Different Workbook
I have three files: 2 Excel Files,1.xls & 3.xlsx , and a text file, 2.csv
1.xls first row has headers so don't count that
In 1.xls count the total number of rows that has data and copy the 3.xlsx sheet3 first row(first complete row copy) and paste that many rows of 3.xlsx first row of sheet3 to 2.csv
suppose 1.xls has data in 5 rows then copy 3.xlsx first row of sheet3 and paste it to 2.csv 5 times
all files are located in a different path
sheet name can be anything
The final result should be a comma separated values text file , 2.csv.
For example, in Notepad, it looks like this:
2csv is a comma seperated text file.JPG : https://imgur.com/FEjKVMs
2csv is a comma seperated text file.jpg
That is the final result that I want
Here is the new answer from me : https://excelfox.com/forum/showthrea...ll=1#post13346
Only a very small change was required:
Code:
' 3b
w2.SaveAs Filename:=ThisWorkbook.Path & "\2.csv", FileFormat:=xlCSV
Let Application.DisplayAlerts = True
w2.Close
Avinash
Read this, and try to understand at least a little of it.
2.csv is a text file. It is not an Excel file.
For example, in Notepad, it looks like this:
2csv is a comma seperated text file.JPG : https://imgur.com/FEjKVMs
2csv is a comma seperated text file.jpg
2.csv is a text file. It is not an Excel file.
You can open a .csv file in Excel, and Excel will do its best to display the data in columns
Sometimes Excel will do this:
_____ Workbook: 2.csv ( Using Excel 2007 32 bit )
Row\Col |
A |
B |
C |
D |
E |
F |
G |
H |
I |
J |
K |
L |
1 |
NSE |
|
6 |
|
|
A |
|
|
|
|
GTT |
|
2 |
NSE |
|
6 |
|
|
A |
|
|
|
|
GTT |
|
3 |
NSE |
|
6 |
|
|
A |
|
|
|
|
GTT |
|
4 |
NSE |
|
6 |
|
|
A |
|
|
|
|
GTT |
|
5 |
NSE |
|
6 |
|
|
A |
|
|
|
|
GTT |
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
Worksheet: 2
Sometimes Excel will do this:
_____ Workbook: 2.csv ( Using Excel 2007 32 bit )
Row\Col |
A |
B |
C |
1 |
NSE,,6,,,A,,,,,GTT |
|
|
2 |
NSE,,6,,,A,,,,,GTT |
|
|
3 |
NSE,,6,,,A,,,,,GTT |
|
|
4 |
NSE,,6,,,A,,,,,GTT |
|
|
5 |
NSE,,6,,,A,,,,,GTT |
|
|
6 |
|
|
|
Worksheet: 2
Alan
Bookmarks