+ Reply to Thread
Results 1 to 9 of 9

Split the data to new files based on the date and name it from the list provided

  1. #1
    Forum Contributor
    Join Date
    06-26-2013
    Location
    Makati
    MS-Off Ver
    Excel 2010
    Posts
    138

    Split the data to new files based on the date and name it from the list provided

    Hi Guys,

    I hope someone can help me with my problem here, i have tried to change the codes many times and try to google it but seems cant find a case like this one.

    Basically what i want the code to do is, get the data from column C:D based on their date, if the date is 1 may, then get all the 1 may data to a newbook, name it as Bday 01 May, after that copy data for 2 may to a new book again, name it as Bday 02 May, and so on until the end of the data. Below is my code and i have attached a dummy workbook too below for your reference, when i run my code, highlighted is this part

    Please Login or Register  to view this content.
    and this is my full code below

    Please Login or Register  to view this content.
    This is actually my first time to do loop code, so i will be glad if someone can help me explain a bit about what i do wrong. Thanks in advance

    Splitting.xlsm

  2. #2
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Split the data to new files based on the date and name it from the list provided

    Hi

    replace your code with below one and run it

    Please Login or Register  to view this content.
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  3. #3
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Split the data to new files based on the date and name it from the list provided

    Moreover if you want to modify your code, try this......
    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  4. #4
    Forum Contributor
    Join Date
    06-26-2013
    Location
    Makati
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: Split the data to new files based on the date and name it from the list provided

    Hi Naveed,

    Thanks you very much for modifying the code into more complex one, now i have something to learn . Thanks !!

    HI sktneer,

    Thank you for modifying my code and revise the part that is wrong. That's really help me a lot in understanding what should i do next time when making a loop code. Thanks you so much !!


    Both of the code works perfectly, star for you both. Thanks guyss :D

  5. #5
    Forum Contributor
    Join Date
    06-26-2013
    Location
    Makati
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: Split the data to new files based on the date and name it from the list provided

    ooops, i forgot to mention something, sometimes the month only have 30 days, how can i modify sktneer code so when its only 30 days, don't care about whats in the row 33 ??

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Split the data to new files based on the date and name it from the list provided

    Change the line of code to

    Please Login or Register  to view this content.
    Thanks for the feedback and rep.

  7. #7
    Forum Contributor
    Join Date
    06-26-2013
    Location
    Makati
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: Split the data to new files based on the date and name it from the list provided

    Hi sktneer,

    Thanks for the reply, changing that line of code will get 30 days for sure, but when the month change to have 31 days i will need to change the line of code again, so what i mean is a code so i don't need to change it every month.

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,647

    Re: Split the data to new files based on the date and name it from the list provided

    In that case change the line of code to

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    06-26-2013
    Location
    Makati
    MS-Off Ver
    Excel 2010
    Posts
    138

    Re: Split the data to new files based on the date and name it from the list provided

    Hi sktneer,

    Thanks!! it works great now. Appreciate your time

+ 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. Split data based on date range
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-03-2014, 06:30 AM
  2. split text files stored in some location to multiple files based on a condition
    By GIRISH_KH in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-01-2013, 11:32 AM
  3. Search from provided data list and return all instances of given criteria
    By dave1983 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-17-2012, 07:01 AM
  4. Extracting desired data from a list when the Unwanted list is provided
    By all4excel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-11-2008, 10:33 AM
  5. Replies: 3
    Last Post: 08-02-2006, 12:35 PM

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