excel_2009
Active Member
- Joined
- Sep 14, 2009
- Messages
- 318
Hi excel gurus,
i stumbled across the following coding:
The coding allows me to import a text file sucessfully into an excel sheet, however i'd like to somehow adapt the coding so that multiple text files can be imported, is that possible?
Thank you
i stumbled across the following coding:
Code:
Sub ImportTextFile()
Dim DestBook As Workbook, SourceBook As Workbook
Dim DestCell As Range
Dim RetVal As Boolean
Application.ScreenUpdating = False
Set DestBook = ActiveWorkbook
Set DestCell = ActiveCell
RetVal = Application.Dialogs(xlDialogOpen).Show("*.txt")
If RetVal = False Then Exit Sub
Set SourceBook = ActiveWorkbook
Range(Range("A1"), Range("A1").SpecialCells(xlLastCell)).Copy
DestBook.Activate
DestCell.PasteSpecial Paste:=xlValues
SourceBook.Close False
End Sub
The coding allows me to import a text file sucessfully into an excel sheet, however i'd like to somehow adapt the coding so that multiple text files can be imported, is that possible?
Thank you