+ Reply to Thread
Results 1 to 42 of 42

producing multiple tabs

  1. #1
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    producing multiple tabs

    guys,
    I am looking for a macro or a formula that can give me multiple tabs, what i need is jan 01 to april 30,the next 2 books i could do by copying of course i have looked at the macros on here and no nothing about them i wouldnt no what to change to give me dates anyway can someone help please
    Attached Files Attached Files
    Last edited by daznav; 02-26-2010 at 10:29 AM.

  2. #2
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: producing multiple tabs

    Hi,
    try this
    Please Login or Register  to view this content.

    You can change this line
    Please Login or Register  to view this content.
    to create workkbook for other periods.
    Uncomment the two lines if you want to skip weekends.

    Buran
    If you are pleased with a member's answer then use the Star icon to rate it.

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: producing multiple tabs

    Hi Buran - hope you don't mind

    Noticed daznav had the date in Range("A1") modified your code to suit, also used "Sheet1" as starting point.

    Please Login or Register  to view this content.
    daznav - if you are happy with this solution please mark your post [Solved]
    And rate Buran's Post not this one.

    P.S.
    error in date formatting
    "mmm-yy" now reads "mmm-dd"
    corrected in two lines above after daznavs' post #5
    Last edited by Marcol; 02-22-2010 at 07:06 AM. Reason: Correction to code

  4. #4
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    thanks that works well but that its going to delete all my holiday files I have on each worksheet but excellent anyway......just to be a bit more of a pain is there a way to date every sheet like that as well so say cell A1 is Jan 01 sheet 2 cell A1 Jan 02......sorry just posted this up and didnt see the next reply i will check it out and reply thanks guys

  5. #5
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    ok that last one puts the dates in but they all say the 10th ie jan 10 feb 10 how can i alter this

  6. #6
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: producing multiple tabs

    Quote Originally Posted by daznav View Post
    thanks that works well but that its going to delete all my holiday files I have on each worksheet but excellent anyway
    Both subs does not delete anything. New workbook is created and worksheets are being added in this new workbook. Mine sub rename each sheet to a date. Marcol sub does the same and also put the date in the cell A1.

  7. #7
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    no worries i worked it out great replies guys helped me out big time

  8. #8
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: producing multiple tabs

    My mistake I have corrected Post #3

    Corretions "mmm-yy" now reads "mmm-dd"
    Last edited by Marcol; 02-22-2010 at 07:04 AM. Reason: Aviod confussion and reduce clutter

  9. #9
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    thanks again but 1 problem i had was that when i tried on a new workbook with junk in a few sheets it deleted what i wrote i think it was because i asked for new tabs my mistake is there a way of renaming tabs and keeping the date in a certain cell so i dont lose my info on any of the data i have on my sheets ...sorry for confusing matters

  10. #10
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: producing multiple tabs

    Hi daznav,
    once again - the subroutine creates new workbook and works with it. So, it dos not delete anything from your workbook.
    Can you explain how to determine the worksheet name - read it from a specific cell or how?

  11. #11
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    Ok on this dummy sheet i have writtrn some mumbo jumbo if i run the macro i will lose this info by doing that on my holiday one i will lose sall my info if i havnt explain i will send through a blank sheet when i return to work in a few days if thats ok it will probably show you more what i mean thankyou
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    I found this VBA surfing around now this works but only if there is a number in cell A1 not the date it dosent recognise it, can you guys understand this and how can i get it to read the date so the tab and A1 are the same



    Please Login or Register  to view this content.
    Last edited by daznav; 02-23-2010 at 03:56 AM.

  13. #13
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: producing multiple tabs

    Please, edit your post and wrap the code in [code] tags.

  14. #14
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: producing multiple tabs

    As Buran states neither code deletes your original data

    Is the problem that you need to add to your workbook?
    and
    Not as we both assumed create a new workbook.

  15. #15
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    guys i appreciate you both looking at this what i will do is send through my actual form when i return to work and see if that clears it up a bit better i will first of all try and see if it works and let you no thank you anyway

  16. #16
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: producing multiple tabs

    Hi daznav,
    We exchanged few private messages with Marcol and we both are not certain what do you want to acheive. Here are some questions, that can help us:
    1. You have workbook with multiple worksheets in it. You want to rename the sheets, based on the value in cell A1. Is this correct?
    2. Do you want also to add worksheets. If yes - how they will be named?
    3. Is there anything else, taht you want to achieve (or that is important for us to know)?

    Buran

  17. #17
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: producing multiple tabs

    Try this if you want to add to your original posted file
    Please Login or Register  to view this content.
    Check your dates in A1 first - they progress in years not days. Is that correct?

    P.S.

    Buran

    My browser must be from the Dark Ages.....I didn't see your post til now.
    Last edited by Marcol; 02-23-2010 at 04:24 AM. Reason: Apologies for missing the previous post by Buran

  18. #18
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: producing multiple tabs

    Quote Originally Posted by Marcol View Post
    P.S.

    Buran

    My browser must be from the Dark Ages.....I didn't see your post til now.
    Could be due to the time difference between Bulgaria and UK ..
    Just kidding :-)

  19. #19
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    Guys ,
    as you can see from this workbook what i was looking for was to rename the tabes as Jan 01 etc and cell B2 as the same date, without losing the information on the sheets i have only set up a few tabs on this work book,the macro that you provided made new worksheets which loses all my information hope this makes it a bit clearer
    thankyou
    Attached Files Attached Files

  20. #20
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: producing multiple tabs

    Hi daznav,
    just to repeat, to be sure I understood it well - you want to rename the existing sheets in the workbook, using the date in cell B2. Name will be in format mmmdd. No new sheets will be created. Please note that in the last file you uploaded there is the same date in cell B2 on all sheets and you know that it is not possible to have two sheets with the same name ... So, is this what you want?

  21. #21
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    your right i was meant to change the dates in b2 but forgot,on my master sheet i have tabs which go from Jan 01 to Apr 30 the one i have sent you has only 4 tabs because its smaller to upload...so yes i want to rename all the tabs to raad dates from Jan 01 2010 to apr 30 2010 and cell B2 to read just the date and month is this possible without losing anything on the worksheets

    im sorry this is so confusing
    Last edited by daznav; 02-24-2010 at 05:14 PM.

  22. #22
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: producing multiple tabs

    Try this code (result from our combined efforts with Marcol):

    Please Login or Register  to view this content.
    Buran

  23. #23
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    sorry guys never worked have left a screen shot for you i think im getting to the stage of manually
    renaming everything lol
    Attached Files Attached Files

  24. #24
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: producing multiple tabs

    The code works fine with the sample file. Is it possible that you have more sheets before sheet "01 JAN 09"? If it is the first sheet, then try this
    Please Login or Register  to view this content.
    and let us know where the error is.
    The best would be to upload the workbook if there are no sensitive data in it. Zip it if it is too big.

  25. #25
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    Where the line ws name == format is thats the error coming up
    Please Login or Register  to view this content.

  26. #26
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: producing multiple tabs

    Check in the workbook you are trying

    How have you formatted cell B2

    I ask because in your original sample.

    You have formatted cell B2 as mmm-yy that gave Jan-01 by entering 01/01/2001
    after copying the the next sheet and changing Jan-01 to Jan-02 did you notice the formula bar returned 01/01/2002
    .....and so on Jan-03 > 01/01/2003............ Jan-04 > 01/01/2004

    All these cells will therefore return Jan01 when formatted mmm-dd

    Could this be where the problem lies?

  27. #27
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    i can see that yes i did format it like you said but im losing hope here i just wanted to show the dates as in B2 as Jan-01 and the tab as Jan-01-2010 i just dont get it my full workbook wont upload says its invalid i really am at lost now thanks for your help anyway i thing i will just slog it out and individually rename it all

  28. #28
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: producing multiple tabs

    Copy the first 6 sheets to a new workbook and send the new book.
    I'll wait for it.
    Don't despair - it will be something simple that is causing the problem.

  29. #29
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    thanks for your patience heres 6 sheets as requested
    Attached Files Attached Files

  30. #30
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: producing multiple tabs

    Hi daznav

    The last code Buran posted ran first time - no problems.

    The only thing I noticed is that all your sheets have Friday in cell F2 is that correct?

    Try saving the book you want to convert using saveas
    remove all marcros from the copy and send me that copy.

    There has to be a reason behind this

    Again I'll wait up for your reply

  31. #31
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    I should have changed that aswell sorry just getting late now i tried Buran last one and it worked so i will try in the morning on my saved copy one thanks for waiting up and having a go at this i will let you know how i get on

  32. #32
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    Hi Marcol,
    bit refreshed now......problem with my workbook is that when i zip it it uploads as an invalid file cant understand why and also unzipped

  33. #33
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    Ok marcol i have the zip file.
    now from here i want to keep all the data on the sheets ok.....the things that need changing are as follows

    All tabs to read dd-mmm-yy

    B2 to also read dd-mmm-yy

    F2 to have the correct day

    now it dosent matter really what format the date is but i think it looks better in this format if you think something else is better i go along with your expert judgement

    hopefully i havnt missed nothing out
    Attached Files Attached Files

  34. #34
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: producing multiple tabs

    Sounds like your file is corrupted

    Try saving the file you want using SaveAs remove all macros from the saved copy and try sending the new file.

    If that dosn't work let me know

    However

    We could produce a template file to produce what you want, the scenario would be

    1/. In the template file there would only be one sheet with all the layout as you have it.
    2/. All you would have to do is fill in the names and any other data you need in this first sheet only.
    3/. Then run the macro, it will produce all the sheets you need in a new workbook and retain the template complete with data you have entered for future use.
    4/. All you would have to do is check and amend this sheet before running the macro again for another period

    Keep your chin up - we'll get there !!!!!

  35. #35
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    actually the one sheet sounds good lol im sure you will crack this

  36. #36
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: producing multiple tabs

    Hi

    All 120 sheets in your workbook have the same date in B2...... - thats why some of the solutions offered by myself and Buran would not run for you!

    You asked for the sheetnames to be based on B2, we assumed they would be different.
    Not an unfair assumption !!!!!!........

    I will give you a solution for both sitations although the single sheet option is the real solution to your problem.

    Can't do it right away - give me a few hours.

  37. #37
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    sorry about that i copied all sheets from sheet 1 only way i could zip it if i was to rename manually it would defeat the object no worries im off to work anyway now, so any how you think this will work i will go along with you both im all ears guys

  38. #38
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: producing multiple tabs

    Try this out.

    This routine is as I described in Post #34

    Fill in whatever data in sheet "Format" no need to fill in date and day (B2 F2) leave them blank
    change anything you need to on this sheet.

    Just don't put anything in B2 & F2 and don't rename this tab.

    This programme will produce a workbook with sheets between any dates you choose.

    Let me know what you think.
    Attached Files Attached Files

  39. #39
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    do i put the dates in the macro if so where and what format

  40. #40
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    Marcol i have just had a go and that is exactly what i was looking for absolutley brilliant, i hope belgium win all the world cups going lol,that is really good mate thanks alot

  41. #41
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: producing multiple tabs

    Hi daznav,

    At last!..

    As a final finess to this problem. I have added the option to include/exclude weekends as was one of Burans' options.

    A new file is attached.

    This is the final coding

    Please Login or Register  to view this content.

    If you are happy that this solves your problem then please mark your post [Solved]
    To mark your thread solved do the following:
    - Go to the first post
    - Click edit
    - Click Advance
    - Just below the word "Title:" you will see a dropdown with the word No prefix.
    - Change to Solve
    - Click Save

    If you are pleased with a member's answer then use the Scales icon to rate it.

    Please don't forget Burans' contribution

    P.S.
    Why Belgium?
    We do have a ferry from Fife to Belgium, but I've never used it!

    Regards
    Alistair
    Attached Files Attached Files
    Last edited by Marcol; 02-26-2010 at 06:41 AM. Reason: P.S. added

  42. #42
    Registered User
    Join Date
    08-28-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    54

    Re: producing multiple tabs

    Marcol told me hes from Belgium earlier or Buran cant remember in this long thread lol sorry Alistair i will put solved 1 thing though it was brilliant but i can now use this from next year onwards because it makes it from the 1 tab which is excellent but like i said i wanted to rename the tabs already there so i didnt lose my data on all the sheets this will be great for the future now thanks alot.great job lads
    Last edited by daznav; 02-26-2010 at 10:29 AM.

+ 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