+ Reply to Thread
Results 1 to 8 of 8

script to create csv file from a worksheet in a multi-sheet workbook

  1. #1
    Forum Contributor
    Join Date
    01-05-2006
    Posts
    113

    script to create csv file from a worksheet in a multi-sheet workbook

    I am working on a workbook that imports data from a csv file on sheet 1 when clicking a macro button. (That is done)

    On sheet 2 I have the data from sheet one displayed in a user friendly format. An the ability to override data. (That is done)

    Then on sheet 3 I have the data from sheet 2 converted back to the format that sheet 1 is in.(That is done)

    The last piece I cant figure out is how to make a macro that will parse through sheet 3 and overwrite the original csv file when clicking a button.

    Sheet 3 data that needs to be extracted is A3:Y250.

    This is an example of what one row in the csv file needs to look like:
    0000 -Fee Desc-,0,-1,10,0,0,0,0,220,30,60,100,0,0,0,0,0,100,0,0,0,0,0,0,0

    Any help would be greatly appreciated. Even if it isnt in a nice one click automated fashion. I just need to get this data into this format so I can upload it into an application and I am running out of time.


    Thanks.
    Last edited by jermsalerms; 05-19-2008 at 10:36 PM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834
    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    01-05-2006
    Posts
    113

    My Solution

    I couldnt get your solution to work (kept getting a runtime error even after changing sheet name) but I was able to do it this way and it works.

    The only question I have is if there a way to remove the commas for rows that do not have information in them. For example if A220:250 were blank I would like to have no commas. Right now I am just going to open the file in notepad and remove them but it would be nice to have a file generated that I didn't need to change.


    Please Login or Register  to view this content.
    Last edited by VBA Noob; 05-20-2008 at 01:08 AM.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834
    What is

    1) the name of the sheet
    2) the name of the workbook

    ???

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    jermsalerms,

    Please read forum rules below and confirm you understand them. I have wrapped your code for you this time

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  6. #6
    Forum Contributor
    Join Date
    01-05-2006
    Posts
    113

    Response to question

    The workbook name will change as this is a spreadsheet that will be custom for each of my clients. Workbook name will look like this..."XXXX - Master GFE Workbook.xls". The XXXX will be a client specific code.

    The sheet that has the output data is named "Output"

    The output file is actually going to be called "GFE.tbl" but in the macro I am using now my output is "GFE.csv" and I am just renaming it to "GFE.tbl"

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    jermsalerms,

    Thread opened. Thanks for agreeing to follow the rules

    VBA Noob
    Last edited by VBA Noob; 05-20-2008 at 01:52 AM.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834
    Misssed "t" in the code...
    Please Login or Register  to view this content.
    Then try
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1