+ Reply to Thread
Results 1 to 7 of 7

Macro to generate 1K copy of source csv files with unique value in 2 columns

  1. #1
    Registered User
    Join Date
    08-06-2015
    Location
    India
    MS-Off Ver
    2010
    Posts
    8

    Macro to generate 1K copy of source csv files with unique value in 2 columns

    Hi all,

    I am new to VB scripting and required your help.

    I want to write a macro to generate 1000 copy of source excel file with unique value in 2 columns.

    Source Excel file format:

    A B C D E F G H I J K l M
    XYZ XYZ XYZ XYZ XYZ
    XYZ XYZ XYZ XYZ XYZ Unique XYZ XYZ XYZ XYZ XYZ XYZ Unique

    Excel file contain 2 Row.

    I want generate 1000 copy of source excel file which contain 2 row as mention above with unique value in cell “F2” and “M2” in each excel and rest all cell values same as source excel.

    Unique value can be simple today date like: 08062015_File_1 to 8062015_File_1000 and can be same for both the cell “F2” and “M2”

    Thanks

  2. #2
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Macro to generate 1K copy of source csv files with unique value in 2 columns

    Excel file contain 2 Row.
    Are you saying that you want the 1000 files to only contain one row of data (in row 2), or do you want them to contain all of the data that is on the source sheet, but only row 2 gets changed?
    Acts 4:12
    Salvation is found in no one else, for there is no other name under heaven given to mankind by which we must be saved.

  3. #3
    Registered User
    Join Date
    08-06-2015
    Location
    India
    MS-Off Ver
    2010
    Posts
    8

    Re: Macro to generate 1K copy of source csv files with unique value in 2 columns

    Hi,

    I have attached the source excel file.

    The source file contains 2 rows and we want to copy both the rows to new 1000 files with same data except for Cell F:2 & M:2 (07082015_0001) where we want unique value in each new file.

  4. #4
    Registered User
    Join Date
    08-06-2015
    Location
    India
    MS-Off Ver
    2010
    Posts
    8

    Re: Macro to generate 1K copy of source csv files with unique value in 2 columns

    Sample excel file format:

    2 Rows 13 Columns - Need to generate 1k copy of this source file with unique value at cell F:2 & M:2 for generated 1K files

    H 20150808 1800 1 50
    D ASD ASD123 ZXC ZXC123 07082015_0001 20150808 20150815 USD 50 07082015_0001
    Last edited by mak177; 08-07-2015 at 02:22 AM.

  5. #5
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Macro to generate 1K copy of source csv files with unique value in 2 columns

    This should do it. Install the code, adjust the pathname any anything else as needed, and save the workbook as a .xlsm. Run as-is to create 3 workbooks for a test. Then change 3 to 1000, save, and run.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-06-2015
    Location
    India
    MS-Off Ver
    2010
    Posts
    8

    Re: Macro to generate 1K copy of source csv files with unique value in 2 columns

    Hi Natefarm,

    Thanks for your help.

    As mention I have changed the path and executed the code.

    It successfully generated the 3 files with unique value for cell F:2 & M:2 as required but it is not populating any other static data in remaining cells.

    It would be really great if you can suggest if I am doing something wrong here.

    Sorry if I didn't explain it properly, I would required all the static data in the 3 new files along with unique value in cell F:2 & M:2 and file to be saved in CSV format if possible.

    Thanks

  7. #7
    Valued Forum Contributor natefarm's Avatar
    Join Date
    04-22-2010
    Location
    Wichita, Kansas
    MS-Off Ver
    2016
    Posts
    1,020

    Re: Macro to generate 1K copy of source csv files with unique value in 2 columns

    Please replace the appropriate three lines above with the following:
    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)

Similar Threads

  1. Macro to generate or copy a pie chart based in new data of individual columns
    By Oscar Buros in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-04-2014, 10:56 AM
  2. Generate Unique List 2 Columns
    By DKolev in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 07-16-2014, 05:22 PM
  3. [SOLVED] Macro to copy selected columns and convert the file into multiple csvmsdos files
    By tanay.vinod in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-08-2014, 03:52 AM
  4. Replies: 0
    Last Post: 02-12-2014, 08:22 AM
  5. Excel Function to Generate list of unique entries from multiple columns
    By ronnycool in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-16-2014, 06:15 PM
  6. Macro to generate a unique number on a shared workbook.
    By adil.master in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-30-2013, 04:22 PM
  7. Copy-Paste Macro of 3 columns from multiple excel files into one summary file
    By jpmaster53 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-15-2012, 07:10 AM

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