Hello,
I have recorded a macro to import text file. I want to run this macro to import more than one text file and save them into a single sheet. I tried using For Next Loop...which is running the macro sequence again..but i am clueless about the syntax on how to save the imported files one after the other ..
Could anyone help me?
The below is the macro which i have recorded and added for next loop...please tell me how to save the text files in the same sheet and run the macro again to save the next one and other text files ?
Note : This query is cross posted at How to run Loop in VBA to import more than one file
Thank you
I have recorded a macro to import text file. I want to run this macro to import more than one text file and save them into a single sheet. I tried using For Next Loop...which is running the macro sequence again..but i am clueless about the syntax on how to save the imported files one after the other ..
Could anyone help me?
The below is the macro which i have recorded and added for next loop...please tell me how to save the text files in the same sheet and run the macro again to save the next one and other text files ?
Code:
<code> Sub Macro()
For i = 1 to 5
Workbooks.OpenText Filename:=Application.GetOpenFilename("Text,*.txt"), _
Origin:=437, StartRow:=4, DataType:=xlFixedWidth, FieldInfo:=Array( _
Array(0, 4), Array(6, 1), Array(11, 1), Array(34, 1), Array(100, 1), ( _
TrailingMinusNumbers:=True
Next i
End Sub</code>
Note : This query is cross posted at How to run Loop in VBA to import more than one file
Thank you