Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Split data into separate file and save according to filename

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    19
    Rep Power
    0

    Split data into separate file and save according to filename

    Hi ExcelFox

    i have provided a sample files.

    i want to seperate the file per part number and save as filename inside the File.xlsx but the file should be on a csv format (SensorExhaustOxygenPFOS730.csv), i hope somebody can help me on this,

    the file on "SensorExhaustOxygenPFOS730.xlsx" should be the result, but on a csv format



    Thanks,
    Pesteness

    cross post section:
    http://www.ozgrid.com/forum/showthre...504#post623504
    Attached Files Attached Files
    Last edited by pesteness; 08-18-2012 at 12:00 AM.

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi Pesteness,

    Welcome to ExcelFox!!

    Download the workbook from here:

    http://www.excelfox.com/forum/f12/sp...les-33/#post81
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  3. #3
    Junior Member
    Join Date
    Aug 2012
    Posts
    19
    Rep Power
    0
    Quote Originally Posted by Admin View Post
    Hi Pesteness,

    Welcome to ExcelFox!!

    Download the workbook from here:

    http://www.excelfox.com/forum/f12/sp...les-33/#post81


    Hi Admin,

    Thanks for the reply, however the title should not be replaced with title1,2,3 etc. as well as the picture and part number , i need the data on it, look at the "SensorExhaustOxygenPFOS730.xlsx" the output should supposed to be like that, i have provided a filename that you can use on the filename column, the program will split the data for part number.

    example part number:PFOS730
    the program will filter all the "PFOS730" in workbook, as you can see in the file.xlsx there so many "PFOS730" i want to filter all and split to a new workbook

    l
    Again, Thank you.

  4. #4
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi

    Sorry for the confusion. That's only dummy data. You have to replace those data with your actual data.
    Last edited by Admin; 08-18-2012 at 01:17 PM.
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  5. #5
    Junior Member
    Join Date
    Aug 2012
    Posts
    19
    Rep Power
    0
    Quote Originally Posted by Admin View Post
    Hi

    Sorry for the confusion. That's only dummy data. You have to replace those data with your actual data.
    its okay,

    yes, i already did that but still the macro just grab a single data, for example this part number "PFOS786" has some duplicate in the my DATA but it has different title, what i wanted to happen is gather all the data within this part number "PFOS786" in one workbook, like below sample, and use the file name in the filename section so for this part number the file name should be "SensorExhaustOxygenPFOS786"


    Part # title etc etc etc....
    PFOS786 Alfa Romeo 75 Twin Spark 4 Cyl 2.0L Exhaust Oxygen Sensor
    PFOS786 Alfa Romeo 75 V6 Cyl 3.0L Exhaust Oxygen Sensor
    PFOS786 Alfa Romeo 164 V6 Cyl 3.0L Exhaust Oxygen Sensor
    PFOS786 Audi 80 Quattro 4 Cyl 1.8L Exhaust Oxygen Sensor
    PFOS786 Audi 90 Sport Quattro 5 Cyl 2.3L Exhaust Oxygen Sensor
    PFOS786 Audi 200 Turbo 5 Cyl 2.2L Exhaust Oxygen Sensor
    PFOS786 Audi Quattro V8 Cyl 3.6L Exhaust Oxygen Sensor
    PFOS786 Audi S4 Turbo 5 Cyl 2.2L Exhaust Oxygen Sensor
    PFOS786 Jaguar Sovereign 6 Cyl 3.6L Exhaust Oxygen Sensor
    PFOS786 Jaguar XJS Sport 6 Cyl 4.0L Exhaust Oxygen Sensor
    PFOS786 Jaguar XJS V12 Cyl 6.0L Exhaust Oxygen Sensor
    PFOS786 Saab 9000 4 Cyl 2.0L Exhaust Oxygen Sensor
    PFOS786 Volvo 240 4 Cyl Exhaust Oxygen Sensor
    PFOS786 Volvo 740 Turbo 4 Cyl Exhaust Oxygen Sensor
    PFOS786 Volvo 740 4 Cyl Exhaust Oxygen Sensor
    PFOS786 Volvo 760 Turbo 4 Cyl Exhaust Oxygen Sensor

    Thanks and God Bless.

  6. #6
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi

    It's working fine here. I got 16 rows of data for SensorExhaustOxygenPFOS786.CSV.

    To fix the file name

    replace

    Code:
    wbkNewFile.SaveAs strOutPutFolder & varUniques(lngLoop) & strFileFormat, lngFileFormatNum
    with

    Code:
    wbkNewFile.SaveAs strOutPutFolder & rngToCopy.Cells(2, 1)  & strFileFormat, lngFileFormatNum
    Post back if any help needed.

    HTH
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  7. #7
    Junior Member
    Join Date
    Aug 2012
    Posts
    19
    Rep Power
    0
    yea! its now working thanks for your help, the only problem now is the filename, i already changed the code from that, but nothings changed and the macro split only single data.


    THANKS
    Last edited by Admin; 08-18-2012 at 05:05 PM.

  8. #8
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Sorry, it should be

    Code:
    wbkNewFile.SaveAs strOutPutFolder & wbkNewFile.Worksheets(1).Range("a2") & strFileFormat, lngFileFormatNum
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  9. #9
    Junior Member
    Join Date
    Aug 2012
    Posts
    19
    Rep Power
    0
    Quote Originally Posted by Admin View Post
    Sorry, it should be

    Code:
    wbkNewFile.SaveAs strOutPutFolder & wbkNewFile.Worksheets(1).Range("a2") & strFileFormat, lngFileFormatNum
    wow, awesome i never knew that someone can answer this, you're a beast!
    I'm starting to like this website, thank you so much for your help.
    i will post something again, hope you can help me again, just a very simple code :o

  10. #10
    Junior Member
    Join Date
    Aug 2012
    Posts
    19
    Rep Power
    0
    Hi Admin,

    about the "split data program" i noticed that the "column A" (file name) is also in the output of the program, i just want to removed the column A (file name) on the output and the part number should start in that column, that file name is just for the files name. thanks god bless

Similar Threads

  1. Split Workbook into Separate Workbooks VBA
    By Admin in forum Download Center
    Replies: 12
    Last Post: 08-08-2018, 09:33 PM
  2. Replies: 34
    Last Post: 03-13-2015, 02:26 PM
  3. Save Worksheets As New File To Specific Folder
    By k0st4din in forum Excel Help
    Replies: 18
    Last Post: 06-08-2013, 04:24 PM
  4. Replies: 1
    Last Post: 03-07-2013, 11:42 AM
  5. Save File In CSV Format VBA
    By Raj Kumar in forum Excel Help
    Replies: 3
    Last Post: 06-01-2011, 07:22 AM

Tags for this Thread

Posting Permissions

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