Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi
Can you tell me how the macro looks like if I would like to import to Excel spreadhseet all txt files from specific folder starting row 1? -- Greatly appreciated Eva |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Eva,
This copies the contents of all text files in the root of C to column A of the active sheet. Change the path to suit your needs Sub LoopThroughDirectory() Dim x As Long Application.DisplayAlerts = False x = 1 MyPath = "C:\" 'Change to suit Fnam = Dir(MyPath & "*.txt") Do While Fnam < "" Open MyPath & Fnam For Input As #1 Do While Not EOF(1) Input #1, Line$ ActiveSheet.Cells(x, 1).Value = Line$ x = x + 1 Loop Close #1 Fnam = Dir() Loop Application.DisplayAlerts = True End Sub Mike "Eva" wrote: Hi Can you tell me how the macro looks like if I would like to import to Excel spreadhseet all txt files from specific folder starting row 1? -- Greatly appreciated Eva |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Works fine :) Thanks
-- Greatly appreciated Eva "Mike H" wrote: Eva, This copies the contents of all text files in the root of C to column A of the active sheet. Change the path to suit your needs Sub LoopThroughDirectory() Dim x As Long Application.DisplayAlerts = False x = 1 MyPath = "C:\" 'Change to suit Fnam = Dir(MyPath & "*.txt") Do While Fnam < "" Open MyPath & Fnam For Input As #1 Do While Not EOF(1) Input #1, Line$ ActiveSheet.Cells(x, 1).Value = Line$ x = x + 1 Loop Close #1 Fnam = Dir() Loop Application.DisplayAlerts = True End Sub Mike "Eva" wrote: Hi Can you tell me how the macro looks like if I would like to import to Excel spreadhseet all txt files from specific folder starting row 1? -- Greatly appreciated Eva |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Eva
See also http://www.rondebruin.nl/csv.htm Or http://www.rondebruin.nl/txtcsv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Eva" wrote in message ... Hi Can you tell me how the macro looks like if I would like to import to Excel spreadhseet all txt files from specific folder starting row 1? -- Greatly appreciated Eva |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Thank you
-- Greatly appreciated Eva "Ron de Bruin" wrote: Hi Eva See also http://www.rondebruin.nl/csv.htm Or http://www.rondebruin.nl/txtcsv.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Eva" wrote in message ... Hi Can you tell me how the macro looks like if I would like to import to Excel spreadhseet all txt files from specific folder starting row 1? -- Greatly appreciated Eva . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Import Several .txt Files | Excel Discussion (Misc queries) | |||
Import multiple text files (Macro) | Excel Discussion (Misc queries) | |||
problem with import files by excel macro | Excel Discussion (Misc queries) | |||
problem with import files by excel macro | Excel Discussion (Misc queries) | |||
Import CSV files using Macro | New Users to Excel |