View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default import few text files from subdirectories

Brateck,

If you simply open one of your text files, which cells are filled with values?

My assumption was that the txt files would start in cell A1, and have contiguous data. You could
try changing this line:

Range("A1").CurrentRegion.Copy _
ThisWorkbook.Worksheets(1).Range("A65536").End(xlU p)(2)


to this

myRows = ThisWorkbook.Worksheets(1).UsedRange.Rows.Count
ActiveSheet.UsedRange.Copy _
ThisWorkbook.Worksheets(1).Cells(myRows + 1, 1)

You may need to add

Dim myRows As Long

at the top of your sub.

HTH,
Bernie
MS Excel MVP


"bratek" wrote in message
ps.com...
everything works almost perfectly... almost.. the problem is that it
does search and open but then it doesn't show anything...
when I turn off the line
myBook.Close
it's show every file in new workbook :(

How to make it works?? that means all files showed in one sheet in one
workbook??

thx :)