Results 1 to 20 of 117

Thread: Convert Many Invoice Formats to a Standard Format

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,894
    Location
    All the macro does is

    1. Get the name of the CSV file
    2. Open the file as a new workbook (wbCSV) and a new active worksheet (wsCSV)
    3. Add column headers to wsCSV
    4. Add row referance in col 9 to go back to original sort order


    At this point THE NEW WORKBOOK that was opened from the CSV should look like this

    Capture.JPG

    This is NOT the workbook with the macro

    5. Then the macro sorts, looks for credits with the same store and date, adds a "9", etc.

    6. The the macro sorts back to original order, cleans up wsCSV

    7. Saves wbCSV as a CSV file, and then closes without Save the wbCSV


    The fact that the WB you sent with the macro has a sheet that looks like this

    Capture1.JPG

    makes it seem to me like you are making changes to the wrong workbook so that

            Set rCSV1 = rCSV.Cells(2, 1).Resize(rCSV.Rows.Count - 1, rCSV.Columns.Count)
    fails because there's only data in the first row, OR the CSV file was completely empty

    All I can suggest is that you first run the macro in the attached workbook to see if it works

    I added some debug MsgBox statements just in case
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

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