Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hi
I have tons of data files in ASCII format. I want to move all individual files as sheets in one excel file. Is there anyway to program a macro to do this? |
#2
![]() |
|||
|
|||
![]()
It can be done, and the best way to get started is to record the macro
to perform the operation once, then alter the macro to accommodate the rest of the files. Additionally, you may need to have 2 files open at once: the "master" file that holds the imported text files, and a "temporary" file that imports the text file. The macro may need to switch from one file to the other to move the imported tab from the temporary file to the master, and then close the temporary file. You can post your code to this newsgroup for debugging assistance. |
#3
![]() |
|||
|
|||
![]()
Hi Dave
Thanks for your reply I have recorded the macro to move a sheet from the txt file to a root file. How do I program it to move all the txt files to the root file? I have named the file in such a way that the last two digits are in a running series. For example 04120801, 04120802,....04120899 Minhao Sub Movesheet() ' ' Movesheet Macro ' ' Sheets("04120802").Select Sheets("04120802").Move Befo=Workbooks("root.xls").Sheets(1) End Sub "Dave O" wrote: It can be done, and the best way to get started is to record the macro to perform the operation once, then alter the macro to accommodate the rest of the files. Additionally, you may need to have 2 files open at once: the "master" file that holds the imported text files, and a "temporary" file that imports the text file. The macro may need to switch from one file to the other to move the imported tab from the temporary file to the master, and then close the temporary file. You can post your code to this newsgroup for debugging assistance. |
#4
![]() |
|||
|
|||
![]()
Sorry , this should be the correct macro.
Sub Movesheet() ' ' Movesheet Macro ' ' ' Windows("04120803.txt").Activate Sheets("04120803").Select Sheets("04120803").Move Befo=Workbooks("root.xls").Sheets(1) Windows("04120802.txt").Activate Sheets("04120802").Select Sheets("04120802").Move Befo=Workbooks("root.xls").Sheets(1) Windows("04120801.txt").Activate Sheets("04120801").Select Sheets("04120801").Move Befo=Workbooks("root.xls").Sheets(1) End Sub "minhao" wrote: Hi Dave Thanks for your reply I have recorded the macro to move a sheet from the txt file to a root file. How do I program it to move all the txt files to the root file? I have named the file in such a way that the last two digits are in a running series. For example 04120801, 04120802,....04120899 Minhao Sub Movesheet() ' ' Movesheet Macro ' ' Sheets("04120802").Select Sheets("04120802").Move Befo=Workbooks("root.xls").Sheets(1) End Sub "Dave O" wrote: It can be done, and the best way to get started is to record the macro to perform the operation once, then alter the macro to accommodate the rest of the files. Additionally, you may need to have 2 files open at once: the "master" file that holds the imported text files, and a "temporary" file that imports the text file. The macro may need to switch from one file to the other to move the imported tab from the temporary file to the master, and then close the temporary file. You can post your code to this newsgroup for debugging assistance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro help | Excel Discussion (Misc queries) | |||
macro - adding rows to a column that is summed | Excel Discussion (Misc queries) | |||
Date and Time Macro | Excel Discussion (Misc queries) | |||
macro interruption: help!!! | Excel Discussion (Misc queries) | |||
Macro for Show/Hide Column | Excel Discussion (Misc queries) |