PC Review


Reply
Thread Tools Rate Thread

copy csv worksheet to xls book using vba/vbs

 
 
anthony.buss@gmail.com
Guest
Posts: n/a
 
      26th Feb 2008
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
 
Reply With Quote
 
 
 
 
Trevor Williams
Guest
Posts: n/a
 
      26th Feb 2008
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

"(E-Mail Removed)" 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
>

 
Reply With Quote
 
anthony.buss@gmail.com
Guest
Posts: n/a
 
      26th Feb 2008
This is perfect! Thanks, Trevor!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy worksheet from one book to open workbook Nev Microsoft Excel Discussion 1 27th Feb 2010 01:23 PM
how do i copy a worksheet to another work book multi work book sheet copies Microsoft Excel Worksheet Functions 1 15th Jul 2008 08:38 PM
How to copy the format of one worksheet to others in same book? =?Utf-8?B?SkxX?= Microsoft Excel Misc 4 27th Jul 2006 06:56 PM
Copy Worksheet from closed book. =?Utf-8?B?U2F1cmp1c2E=?= Microsoft Excel Programming 2 10th Nov 2005 05:49 PM
How to Copy worksheet from one book to another in Classic ASP SayeeExcel Microsoft Excel Programming 0 27th Oct 2004 07:32 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:02 AM.