![]() |
how can I arrage file in folder into worksheet
dear all
I try download file from spectroradiometer machine data is released in csv. format automatically in folder however, I want to arrange all data only in 1 worksheet can anyone help me how to use macro in excel to do that? need you sharing if ever done it? thanks evri |
how can I arrage file in folder into worksheet
Just opening the file in Excel should do what you want.
Sub Openfile() workbooks.Open "C:\Myfiles\"abc.csv" End sub If you mean you want to combine multiple files sub OpenMany() Dim bk as Workbook Dim bk1 as Workbook Dim rng as Range Dim cell as Range Dim bFirst as Boolean Dim fName as String fname = Dir("C:\Myfiles\*.csv") bFirst = True do while fname < "" set bk1 = Workbooks.Open( "C:\Myfiles\" & fName) set rng = bk.Worksheets(1).Usedrange if bFirst then bk.SaveAs "C:\XLS\MyData.xls" set bk1 = bk bFirst = False else set cell = bk1.Worksheets(1).Cells(rows.count,1).end(xlup)(2) rng.copy Destination:=cell bk.close SaveChanges:=False end if fName = Dir() Loop bk1.Save End Sub -- Regards, Tom Ogilvy "evri" wrote in message ... dear all I try download file from spectroradiometer machine data is released in csv. format automatically in folder however, I want to arrange all data only in 1 worksheet can anyone help me how to use macro in excel to do that? need you sharing if ever done it? thanks evri |
All times are GMT +1. The time now is 02:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com