Hi

i don't know whether this would work in your case, but give it try.

Sub MultiImporttest()
Dim flname
Dim filename
Dim FileNum As Integer
Dim Counter As Long, maxrow As Long
Dim WorkResult As String
Dim ws As Worksheet
On Error GoTo ErrorCheck
maxrow = Cells.Rows.Count
'Ask for the name of the file.
filename = Application.GetOpenFilename(FileFilter:="all file (*.*),*.*",
MultiSelect:=True)
'Check for no entry.
If VarType(filename) = vbBoolean Then
Exit Sub
End If

Application.ScreenUpdating = False
Application.EnableEvents = False

Counter = Cells(Cells.Rows.Count, "a").End(xlUp).Row
For Each flname In filename
FileNum = FreeFile()
Open flname For Input As #FileNum
Do While Seek(FileNum) <= LOF(FileNum)
Application.StatusBar = "Importing Row " & _
Counter & " of text file " & flname
Line Input #FileNum, WorkResult
Set ws = Nothing
Set ws = ActiveSheet
ws.Select
Cells(Counter, 1) = WorkResult
If WorkResult <> "" Then
Application.DisplayAlerts = False
Cells(Counter, 1).TextToColumns Destination:=Cells(Counter, 1),
DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, Semicolon:=False, Comma:=True, Space:=False, Other:=False
End If
Counter = Counter + 1
If Counter > maxrow Then
MsgBox "data have over max rows: " & maxrow
Exit Sub
End If
Loop
'Close the open text file.
Close
Next

'Reset the application to its normal operating environment.
Application.StatusBar = False
Application.EnableEvents = True
Application.ScreenUpdating = True
Exit Sub
ErrorCheck:
'Reset the application to its normal operating environment.
Application.StatusBar = False
Application.EnableEvents = True
Application.ScreenUpdating = True
MsgBox "An error occured in the code."
End Sub

keizi

"tuggers" <tuggers.23mo2p_1140606603.494@excelforum-nospam.com> wrote in message
news:tuggers.23mo2p_1140606603.494@excelforum-nospam.com...
>
> Thanks for the interest guys
>
> I have been trying to open them via the open option in the file menu on
> the menu bar. This seems to be the only way to import dat. files??
> Then when i had selected them all and gone through the import text
> screens, each file is imported as a seperate worksheet.
>
> If there is a better way, id be happy to try it.
> Is anybody able to supply me with the required vba code to import the
> entire contents of the folder into a single worksheet?
>
> I would greatly appreciate it.
>
>
> --
> tuggers
> ------------------------------------------------------------------------
> tuggers's Profile:

http://www.excelforum.com/member.php...o&userid=29000
> View this thread: http://www.excelforum.com/showthread...hreadid=514838
>