I am very new to excel macros.
Could anyone help me to create a macro to merge all *.csv files in one folder to a single new excel file in other folder?
Thanks a lot in advance...
I am very new to excel macros.
Could anyone help me to create a macro to merge all *.csv files in one folder to a single new excel file in other folder?
Thanks a lot in advance...
Try this code
Copy the Excel VBA code![]()
Please Login or Register to view this content.
Select the workbook in which you want to store the Excel VBA code
Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
Choose Insert | Module
Where the cursor is flashing, choose Edit | Paste
To run the Excel VBA code:
Choose View | Macros
Select a macro in the list, and click the Run button
If I have helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
Thanks a lot for the code. But I got a "Compile error: Variable not defined" message, and stopped on "lrow = ..." line.
Could you help me out again. - Thanks again
Oops. Just add dim lrow as long at the end of all the dim statements.
Thanks, no more compile error. however I didn't get a result that I was looking for. Maybe I didn't explain well on my expected result.
I am trying to read all *.csv file in folder and put in one excel file as worksheet per .csv file.
So, if I read 5 csv files, I would expect 5 sheets with each csv file name in the excel file.
Would that be possible? Thanks a lot for you help
Updated code -
![]()
Please Login or Register to view this content.
Works great! thanks a lot for your fast response
Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.
In future, to mark your thread as Solved, you can do the following -
Select Thread Tools-> Mark thread as Solved.
Incase your issue is not solved, you can undo it as follows -
Select Thread Tools-> Mark thread as Unsolved.
Thanks for the rep.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks