Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Auto format a csv file?

Hi,
I have reports I do that are output as csv type. I then must do quite a bit
of formatting and then copy the data into a template.An example of what I
do: Open csv in excel, in col a replace all 2's & 3's with text (same word)
and replace 5's with a different word. col A contains ONLY one of these 3
numbers. then I format 4 cols as $, 2 as numbers. I then sort descending by
col A, ascending by Col B. Their are a few more things but all have to do
with formatting and/or sorting.Can something like this be automated with a
macro or something?
Thanks
Frank


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9,101
Default Auto format a csv file?

That is what VBA is all about. The best way for a novice to start is to turn
on the auto macro record. Then perform your normal formating. Then turn off
the macro record. You probably will have to customise the macro after it is
recorded. You can post the macro on this website under excel programming if
you need help with the macro.


Here is how you would start.
1) Start new workbook and read Csv file
1) On Excel Toolbar Select Tools - Macro - Record New Macro
2) Perform your normal formating
3) Turn off recording Select Tools - Macro - Stop Recording.
4) To run Macro Seclect Tools - Macro - Macros - Macro1 - Run
5) To Edit Macro Seclect Tools - Macro - Macros - Macro1 - Edit

if you want to post macro, edit macro and then copy and p[aste macro on this
website.

You can also have the macro do the reading of the csv file by starting macro
before you read the csv file. Or have two macros, one for reading and one
for formatting.

"Frank" wrote:

Hi,
I have reports I do that are output as csv type. I then must do quite a bit
of formatting and then copy the data into a template.An example of what I
do: Open csv in excel, in col a replace all 2's & 3's with text (same word)
and replace 5's with a different word. col A contains ONLY one of these 3
numbers. then I format 4 cols as $, 2 as numbers. I then sort descending by
col A, ascending by Col B. Their are a few more things but all have to do
with formatting and/or sorting.Can something like this be automated with a
macro or something?
Thanks
Frank



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Auto format a csv file?

Frank

Fire up the macro recorder and start doing the stuff you need to do including
opening the csv file.

Most times some alterations to the code is necessary, like changing hard-coded
cell refs to offsets and similar but if you use the Relative Reference button
there won't be too many to change.

See Tushar Mehta's "Beyond the macro recorder" site for tips.

http://www.tushar-mehta.com/excel/vb...rder/index.htm


Gord Dibben MS Excel MVP

On Sun, 27 May 2007 16:11:55 -0400, "Frank"
wrote:

Hi,
I have reports I do that are output as csv type. I then must do quite a bit
of formatting and then copy the data into a template.An example of what I
do: Open csv in excel, in col a replace all 2's & 3's with text (same word)
and replace 5's with a different word. col A contains ONLY one of these 3
numbers. then I format 4 cols as $, 2 as numbers. I then sort descending by
col A, ascending by Col B. Their are a few more things but all have to do
with formatting and/or sorting.Can something like this be automated with a
macro or something?
Thanks
Frank


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
Can I auto save to a separate file?(not the file I am working in) Jim Lynch Setting up and Configuration of Excel 1 August 14th 06 05:20 PM
Excel Auto-Format cell to email format Please Help Me Excel Discussion (Misc queries) 1 March 23rd 06 05:15 PM
How to format a number cell to auto count 1 up on file open Joevee Excel Worksheet Functions 0 February 1st 06 05:00 PM
Macro to auto save file using the format YYMM Dolphinv4 Excel Discussion (Misc queries) 1 September 29th 05 04:09 AM
auto save excel file every 10 minutes to its original file name MEG Excel Discussion (Misc queries) 3 September 8th 05 07:12 PM


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