Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Copy from CSV

Hello
I am trying to open a CSV file and copy portions from it. I would like to
open
\\mypath\myfile.csv then copy B3:Y3 to my other file sheet1 B5:Y5.
Could someone please help?




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Copy from CSV

I recorded this macro

Workbooks.Open Filename:="Mypath\myfile.csv"
Range("B3:Y3").Select
Selection.Copy
Windows("MyOtherFile").Activate
Range("B5").Select
ActiveSheet.Paste

When I activate the code it works but when I copy it into another module I get
Application-defined or Object-defined error . The only difference is that
the 2 files are not in the same directory.


"Thanks" wrote:

Hello
I am trying to open a CSV file and copy portions from it. I would like to
open
\\mypath\myfile.csv then copy B3:Y3 to my other file sheet1 B5:Y5.
Could someone please help?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Copy from CSV

1. start with your original workbook
2. turn on the recorder
3. Data Import External Data Import Data
(tell the Wizard where the .csv file is and tell the Wizard to make a new
sheet)
4. copy the desired data from the new sheet to the original sheet
5. turn off the recorder


Using the Import Wizard means that you do not have to deal with two open
workbooks, only two worksheets.
--
Gary''s Student - gsnu200829


"Thanks" wrote:

I recorded this macro

Workbooks.Open Filename:="Mypath\myfile.csv"
Range("B3:Y3").Select
Selection.Copy
Windows("MyOtherFile").Activate
Range("B5").Select
ActiveSheet.Paste

When I activate the code it works but when I copy it into another module I get
Application-defined or Object-defined error . The only difference is that
the 2 files are not in the same directory.


"Thanks" wrote:

Hello
I am trying to open a CSV file and copy portions from it. I would like to
open
\\mypath\myfile.csv then copy B3:Y3 to my other file sheet1 B5:Y5.
Could someone please help?




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
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
copy formulas from a contiguous range to a safe place and copy them back later Lucas Budlong Excel Programming 2 February 22nd 06 08:26 PM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM
How copy format, font, color and border without copy/paste? Michel[_3_] Excel Programming 1 November 5th 03 04:43 PM


All times are GMT +1. The time now is 06: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"