importing delimited text

ckmoied

Board Regular
Joined
Oct 13, 2002
Messages
154
I am trying to import a comma delimeted text. I have just tried to use the following macro code as posted on MrExcel web site. (http://www.mrexcel.com/tip025.shtml) However it just copies and pastes the data without putting the data in separate columns. However I want to put the data as delimited in separate columns.

Also I want to import not just one but several files at the same time.

Any suggestion, Please let me know.
--------------
VBA code as macro


Sub Auto_Open()
' This macro will put today's date as the default new tab name
Sheets("Menu").Select
Range("D5").Select
Selection.Formula = "=text(now(),""mmm dd yyyy"")"
Selection.Copy
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
Selection.Columns.AutoFit
Range("D8").Value = ""
End Sub

Sub GetFile()
' This macro will import a file into this workbook
' Copyright 1999 http://www.MrExcel.com
Sheets("Menu").Select
PathName = Range("D3").Value
Filename = Range("D4").Value
TabName = Range("D5").Value
ControlFile = ActiveWorkbook.Name
Workbooks.Open Filename:=PathName & Filename
ActiveSheet.Name = TabName
Sheets(TabName).Copy After:=Workbooks(ControlFile).Sheets(1)
Windows(Filename).Activate
ActiveWorkbook.Close SaveChanges:=False
Windows(ControlFile).Activate
Sheets("Menu").Select
Range("D8").Select
ActiveCell.Value = "Completed"
Range("D9").Select
End Sub
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Easiest way is to record yourself doing it...opening the csv file from within Excel - this will give you your exact code.
 
Upvote 0

Forum statistics

Threads
1,224,895
Messages
6,181,620
Members
453,057
Latest member
LE102024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top