Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
in which folder can you save a .CSV file? chivagirl Excel Discussion (Misc queries) 17 December 31st 07 10:44 PM
Need code to save file to new folder, erase from old folder Ron M. Excel Discussion (Misc queries) 1 February 24th 06 06:02 PM
open file from folder save in new folder tim64[_3_] Excel Programming 20 June 17th 05 07:58 PM
Create Folder and Text File in folder Todd Huttentsine Excel Programming 2 April 29th 04 03:41 PM
check if file is in particular folder nikolaosk[_10_] Excel Programming 2 October 18th 03 04:25 PM


All times are GMT +1. The time now is 09:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"