+ Reply to Thread
Results 1 to 12 of 12

Create a new sheet for every Date or paste it below the existing date if the sheet exists

  1. #1
    Registered User
    Join Date
    03-05-2014
    Location
    London, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Create a new sheet for every Date or paste it below the existing date if the sheet exists

    Hi There,

    I want to create a new worksheet for every date or if the sheet exists paste the data in that sheet below the existing data.

    I am new to this so I need help. I have also created two buttons to test the code

    I found these codes from Mr Ron De Bruin's website and modified it to create new sheets with date as sheet name but when I try the paste the data in the existing sheets it is not working and new sheets are created without any name.

    Hope you guys can help
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Create a new sheet for every Date or paste it below the existing date if the sheet exi

    Can you attach a sample file with data and desired result ?
    If solved remember to mark Thread as solved

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Create a new sheet for every Date or paste it below the existing date if the sheet exi

    The code you have works. See attached.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    03-05-2014
    Location
    London, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Create a new sheet for every Date or paste it below the existing date if the sheet exi

    Hi AB33,

    Thank you for your reply

    The code works the first time to create new worksheets but when I try to paste data (the second time) in the existing worksheets it does not work. You can check this out by clicking Button 1 the second time.

    Hope you can help me with this.

  5. #5
    Registered User
    Join Date
    03-05-2014
    Location
    London, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Create a new sheet for every Date or paste it below the existing date if the sheet exi

    Hi There,

    I have attached the file, the file contains two command buttons and when the first button is clicked new worksheets with dates as names are created but the problem occurs when I try to paste the data the second time into the existing sheets.

    Hope you can help

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Create a new sheet for every Date or paste it below the existing date if the sheet exi

    Are you missing an attachment in Post#5?

  7. #7
    Registered User
    Join Date
    03-05-2014
    Location
    London, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Create a new sheet for every Date or paste it below the existing date if the sheet exi

    Hi John,

    The file was attached to the first post and also to the 3rd

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Create a new sheet for every Date or paste it below the existing date if the sheet exi

    Look at the attached. I re-run my code to check it copies in to next row. Module 4.
    Attached Files Attached Files
    Last edited by AB33; 03-13-2014 at 09:57 AM.

  9. #9
    Registered User
    Join Date
    03-05-2014
    Location
    London, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Create a new sheet for every Date or paste it below the existing date if the sheet exi

    Hi AB33,
    Thank you very much for your help,
    Sorry I could not get back sooner.
    Your code works fine when there is an existing worksheet with date as its name.
    However when I tried to append the next set of data this gave an error. (Run time error 91- Object variable with block variable not set) in the line
    NR = .Cells.Find("*", , , , xlByRows, xlPrevious).Row + 1
    I do not know the reason can you please help?
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Create a new sheet for every Date or paste it below the existing date if the sheet exi

    You can use this line, but I have amended the code to copy the headers for new sheets.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by AB33; 03-15-2014 at 06:41 AM.

  11. #11
    Registered User
    Join Date
    03-05-2014
    Location
    London, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Create a new sheet for every Date or paste it below the existing date if the sheet exi

    Hi AB33,

    Thank you very much, I found out that your previous code needs a Header to work properly, Once I named a sheet and gave a header it works beautifully.

    The new code however copies everything twice!! So I need your help once again, sorry for the bother.

  12. #12
    Registered User
    Join Date
    03-05-2014
    Location
    London, UK
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Create a new sheet for every Date or paste it below the existing date if the sheet exi

    Hi AB33,

    I used the line of code as you suggested and it works - creates new worksheets and copies the data as well. Fantastic!!! THANK you very much

+ 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. Replies: 4
    Last Post: 11-05-2013, 09:22 PM
  2. [SOLVED] Need to find date from one sheet and paste in 2nd sheet
    By punna111 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-19-2013, 01:47 PM
  3. Copy/paste row with todays date in Sheet2 to sheet 3....but from Sheet 1
    By cammyjane10 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-25-2013, 01:07 PM
  4. [SOLVED] Find the date and copy the values from the colum of the date find and paste to other sheet
    By nizzcmzph in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-20-2013, 10:03 AM
  5. Copy Sheet / Create & Name New Sheet / Insert Before a Sheet / Paste Data
    By thinkspac in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-12-2012, 02:27 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