Hi all,
i am trying to open multiple text files, copy and paste in single excel sheet ( one by one). i am use below code it open all the text file into excel but unable to copy and paste in single excel sheet. can any one help..
Sub loopyarray()
Dim filenames As Variant
' 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)
' displays file name in a message box
MsgBox filenames(counter)
'increment counter
counter = counter + 1
Wend
End Sub
Thanks
Jack
Bookmarks