![]() |
Importing Text File
Hi Guys, has anyone got a macro where I can import a text file saved on my computer into a new sheet named yesterdays or todays date in format "ddmmyy" and then the sheet gets hidden. Thanks in advance for your help Gunny -- gunny1979 ------------------------------------------------------------------------ gunny1979's Profile: http://www.excelforum.com/member.php...o&userid=32932 View this thread: http://www.excelforum.com/showthread...hreadid=545015 |
Importing Text File
Sub ImportData() ThisWorkbook.Sheets.Add after:=Sheets(Sheets.Count) ActiveSheet.Name = Format(Date, "ddmmyy") Workbooks.Open FileName:="C:\text.txt", Format:=2 Cells.Copy ThisWorkbook.Sheets(Format(Date, "ddmmyy")).[a1] Workbooks("text.txt").Close savechganges:=False Sheets(Format(Date, "ddmmyy")).Visible = False End Sub Change "C:\text.txt" to refer to your file. I've assumed that the file is comma-delimited. If it's not, change the "Format:=2" to whatever you need it to be (check Help for the Open method for the options). Col -- colofnature ------------------------------------------------------------------------ colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356 View this thread: http://www.excelforum.com/showthread...hreadid=545015 |
Importing Text File
Hi Gunny,
use macro recorder. In case you will need to modify the recorded code, post it in the forum. Regards, Ivan |
All times are GMT +1. The time now is 11:17 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com