+ Reply to Thread
Results 1 to 6 of 6

Saving corresponding filesnames within a Macro

  1. #1
    Registered User
    Join Date
    01-08-2007
    Posts
    35

    Question Saving corresponding filesnames within a Macro

    I'm currently working with this simple macro:

    Please Login or Register  to view this content.
    This simple macro is basically taking my pre-existing .csv files lableled submissions1-9.csv with a total of 45 rows per each .csv and spliting them up into 3 separate .csvs of 15 rows and saving them individually.

    I need a solution to where I can open my .csv files, for example, one is named submissions6.csv and the macro will automatically save the 3 split .csv files as submissions6-1.csv, submissions6-2.csv, submissions6-3.csv and repeat the process for other .csv files I open.

    IDEALLY >> if there is a way to take it one step further and have the macro open multiple .csv files, example: submissions1-9.csv and split up EACH ONE, that would be great!!

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Saving corresponding filesnames within a Macro

    Hi, grafx77,

    maybe try this (untested):
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    01-08-2007
    Posts
    35

    Re: Saving corresponding filesnames within a Macro

    Thanks for the help Hahobe, and you almost have it, but when splitting up my main .csv it separates the 3 csv files into 1 with 15 rows, 1 with 30 rows, and 1 with 45 rows. The macro I was using, split up the main csv into 3 separate csv files each containing 15 rows. Example:

    1st csv was row 1-15
    2nd csv was row 16-30
    3rd csv was row 31-45

    So almost there.....probably just needs a little tweeking.

  4. #4
    Valued Forum Contributor mohan.r1980's Avatar
    Join Date
    09-18-2010
    Location
    Mumbai, India
    MS-Off Ver
    Excel 2010 (windows7)
    Posts
    729

    Re: Saving corresponding filesnames within a Macro

    Hello grafx77

    Assuming that you have 45 data
    Please try this code


    '
    Please Login or Register  to view this content.
    Last edited by mohan.r1980; 10-22-2012 at 06:13 AM.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Saving corresponding filesnames within a Macro

    Hi, grafx77,

    change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    01-08-2007
    Posts
    35

    Re: Saving corresponding filesnames within a Macro

    +1 to HaHoBe!

    Thanks bud! Works like a charm now!

+ 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