+ Reply to Thread
Results 1 to 9 of 9

How to ignore non-weekdays

  1. #1
    Valued Forum Contributor
    Join Date
    02-09-2006
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2016
    Posts
    1,081

    How to ignore non-weekdays

    I came across this great bit of code which successfully changes tab names in the attached monthly workbook.

    However, I want the finished workbook to contain only sheets for weekdays. If a cell in Worksheets!A = FALSE the macro leaves the worksheet name as "sheetn", moves to the next worksheet and does the same, then changes the name on the subsequent worksheet.

    Can I make it skip over the FALSE rows in Worksheets!A so that all of the unchanged tabs are at the far end of my workbook? Ideally I would like to delete all remaining worksheets named "sheetn".

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Trish in Oz
    -------------
    A problem well defined is a puzzle half solved


    If you attach a sample of your workbook it will be easier to find a solution. Remember to remove/replace sensitive data before uploading the file. Look here if you need help with attachments:
    http://www.excelforum.com/faq.php?fa...b3_attachments

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: How to ignore non-weekdays

    Hello

    Let's try this
    Please Login or Register  to view this content.
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Valued Forum Contributor
    Join Date
    02-09-2006
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2016
    Posts
    1,081

    Re: How to ignore non-weekdays

    It's magic! Well - almost.

    Thanks very much for this code. I edited it so that the rename sub works on rows A2:A40 but it only renames up to row 23 - see attached test workbook. I can't see anything else in the code that might prevent it from renaming the other tabs.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: How to ignore non-weekdays

    It's because you have only 22 Sheets in your workbook, so code finds only 22 sheets to rename !

    Create 10 more sheets in your workbook and then run the code!

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: How to ignore non-weekdays

    @tuph

    why not just only add the weekday(data) in the range (of your first sheet?
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  6. #6
    Valued Forum Contributor
    Join Date
    02-09-2006
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2016
    Posts
    1,081

    Re: How to ignore non-weekdays

    Aha! That worked. Thanks very much. This code will help me in all sorts of ways.

  7. #7
    Valued Forum Contributor
    Join Date
    02-09-2006
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2016
    Posts
    1,081

    Re: How to ignore non-weekdays

    Quote Originally Posted by oeldere View Post
    why not just only add the weekday(data) in the range (of your first sheet?
    Thanks for the suggestion but I want to create a template which is quick and easy for others to use. Using this method all the user needs to do is change the date in cell B2 to update the rest of the month on the Names worksheet then run the macro. The workbook is then ready to use. The left over worksheets are out of the way at the far end of the workbook and the user can choose whether to delete or ignore them.

  8. #8
    Valued Forum Contributor
    Join Date
    02-09-2006
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2016
    Posts
    1,081

    Re: How to ignore non-weekdays

    Quote Originally Posted by tuph View Post
    Aha! That worked. Thanks very much. This code will help me in all sorts of ways.
    Now I'm really stumped oeldere! It worked until I saved the workbook as a macro enabled template. When I creaet a new workbook using the template the macro only works as far as row 30 in the Names worksheet. The uploader would not allow me to attach the template so I have attached a workbook created from the template.
    Attached Files Attached Files
    Last edited by tuph; 06-10-2014 at 07:10 PM.

  9. #9
    Valued Forum Contributor
    Join Date
    02-09-2006
    Location
    Melbourne, Australia
    MS-Off Ver
    Office 2016
    Posts
    1,081

    Re: How to ignore non-weekdays

    Quote Originally Posted by tuph View Post
    Now I'm really stumped oeldere! It worked until I saved the workbook as a macro enabled template. When I creaet a new workbook using the template the macro only works as far as row 30 in the Names worksheet. The uploader would not allow me to attach the template so I have attached a workbook created from the template.
    Actually I'm just stupid. The worksheet names have all been updated - they are simply sorted in text order rather than as dates. Is there any way around this?

    This workbook is populated with a daily export of completed sales orders from our accounting system that allows us to back date invoicing on day 1 of the new month as the last day of the previous month. Logically, the first day of next month needs to follow the last day of this month in sequence.

+ 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. [SOLVED] Weekdays
    By scalesy in forum Excel General
    Replies: 4
    Last Post: 02-04-2014, 08:22 AM
  2. Replies: 12
    Last Post: 07-04-2013, 07:26 AM
  3. Weekdays, I wish!
    By AlanWade in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 06-20-2008, 05:47 AM
  4. Weekdays
    By mangesh in forum Excel General
    Replies: 2
    Last Post: 10-27-2006, 09:37 AM
  5. [SOLVED] Weekdays
    By Jeff in forum Excel General
    Replies: 7
    Last Post: 02-14-2005, 09:06 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