Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Best Practice - Transfer Data

Purpose: Copy 2 column of data from .csv file & Paste Special (value only) to
an Excel Template.
Question: What is the best way of achieving this?

What I tried #1: record a Macro, starting from the Template file Open the
..csv file in Excel Copy Needed 2 columns of data Paste Special value only
starting E11 Close .csv file Answer No to the data on clipboard questions
Go back to Template File. Stop the Macro recording.


Problem with Macro #1: I checked the code after recording this Macro, the
code doesn't specify File Name (report.csv) Nor the location of the file
(Desktop)
__________________________

What I tried #2: record a Macro, starting from the Template file Unprotect
file, enter password Run Import Text File Wizard Choose Comma as
Delimiter Go over column by column to select "Do not import column (skip)"
to skip the rest of the columns except the two columns needed.

Problem with Macro #2: (1) The Wizard seem to adjust the row height to fit
the font size. (2) Don't know how to embed the unprotect password to the
code, so that user won't need to enter it. (3) Also Don't know how to embed
the code to Protect the Templet after running the Wizard.

Other Variable Factor Known: Amount of rows of data that two columns might
be different from time to time.

I'm sorry if this is too lengthy, just want to make sure everyone understand.

Thank you in advance.

Neon520
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Best Practice - Transfer Data

Hi Neon,

You can edit Macro1 and specify a file name.

As and aside, regarding best practices: I always recommend *NOT* to
use copy and paste.

It's a killer on performance - it could make Excel hang for some
users.

Also, programmatically, it's easier because you know exactly how many
rows of data you've iterated through and you know exactly where to
start if you need to insert more data from another CSV.

I recommend that you iterate through the CSV a line at a time, but if
performance is *really* important, insert the data into the worksheet
in bursts of several rows at once instead of a row at a time.
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
Excel Data Protection Best Practice: AKA: Real Sheet Protection Mushman(Woof!)[_2_] Excel Discussion (Misc queries) 4 December 30th 09 01:20 AM
Best Practice - Transfer Data Neon520 Excel Programming 0 February 17th 09 09:39 PM
Activate Sheet Best Practice (Y/N?) when xFer data between sheets? [email protected] Excel Programming 2 July 3rd 07 04:52 PM
Transfer Data from Excel 2000 to the Access data base André Lavoie Excel Programming 1 September 28th 05 03:22 PM
Transfer data from XL into Access: best practice quartz[_2_] Excel Programming 2 June 24th 05 09:30 PM


All times are GMT +1. The time now is 07:11 PM.

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"