Hi all,
Here is the code for copy data from mulitple text file and paste in single sheet..
Sub Button1_Click()
Dim filenames As Variant
Application.DisplayAlerts = False
' set the array to a variable and the True is for multi-select
filenames = Application.GetOpenFilename(, , , , True)
counter = 1
' ubound determines how many items in the array
While counter <= UBound(filenames)
'Opens the selected files
Workbooks.Open filenames(counter)
ActiveWindow.Activate
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Windows("cONVERT.xlsm").Activate
Sheets("Report").Select
ActiveSheet.Paste
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Activate
ActiveWindow.ActivateNext
ActiveWindow.Close
Application.DisplayAlerts = False
' displays file name in a message box
'MsgBox filenames(counter)
'increment counter
counter = counter + 1
Wend
End Sub
Regards
Jack
Bookmarks