Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default copy csv worksheet to xls book using vba/vbs

Hello all,

I've been searching the web and posts for almost 4 weeks and can't
seem to find what I need. Please forgive me I'm new to programming
with VBA/VBS.

Basically I have file #1 <file1.csv which contains a result set
created by another application. What I'd like to do is use a script
to copy the values from sheet1 (or the whole sheet would be fine) into
file #2 <file2.xls so users can run formulas, vlookups, etc. without
having to access a separate file (and leave the original data
untouched).

Is there an efficient way to do this with vba or vbs? It seems easy
enough but I can't put my finger on it.

Thanks,
-ab
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default copy csv worksheet to xls book using vba/vbs

Hi Anthony

Here's a very basic version of what you're looking to do.
With File2.xls open, tt opens the CSV file and copies the data sheet to the
end of the XLS file.

'Change file names and directory name accordingly
Sub CopyCSVdata()
Workbooks.Open Filename:= _
"C:\File1.csv"
Sheets("File1sheet").Copy After:=Workbooks("File2").Sheets.Count
End Sub

HTH
Trevor Williams

" wrote:

Hello all,

I've been searching the web and posts for almost 4 weeks and can't
seem to find what I need. Please forgive me I'm new to programming
with VBA/VBS.

Basically I have file #1 <file1.csv which contains a result set
created by another application. What I'd like to do is use a script
to copy the values from sheet1 (or the whole sheet would be fine) into
file #2 <file2.xls so users can run formulas, vlookups, etc. without
having to access a separate file (and leave the original data
untouched).

Is there an efficient way to do this with vba or vbs? It seems easy
enough but I can't put my finger on it.

Thanks,
-ab

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default copy csv worksheet to xls book using vba/vbs

This is perfect! Thanks, Trevor!
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
how do i copy a worksheet to another work book multi work book sheet copies Excel Worksheet Functions 1 July 15th 08 08:38 PM
How to copy the format of one worksheet to others in same book? JLW Excel Discussion (Misc queries) 4 July 27th 06 06:56 PM
Copy Worksheet from closed book. Saurjusa Excel Programming 2 November 10th 05 05:49 PM
How to Copy worksheet from one book to another in Classic ASP SayeeExcel Excel Programming 0 October 27th 04 07:32 PM
Copy WorkSHeet To New Book With Print Page Settings ? Mike Iacovou Excel Programming 2 June 12th 04 09:58 PM


All times are GMT +1. The time now is 05:49 AM.

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

About Us

"It's about Microsoft Excel"