LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Rename Worksheets excluding Weekends and Holidays

Hi All,

I would greatly appreciate any help with the following:

I have an excel workbook that contains a number of worksheets.
The first is called "Control", the next is called "A" and the last sheet
is called "B". In between sheets A and B are individual sheets, one
for every day of a month. In cell A:2 on the control sheet I enter
a start date and the following code renames all the individual
sheets based on the start date e.g. Nov 1, Nov 2 etc.

Sub RenameSheets()
Dim i As Long
Dim sh As Worksheet
Dim dte As Date
Dim dte1 As Date

If IsDate(Worksheets("Control").Range("A2").Value) Then
dte1 = CDate(Worksheets("Control").Range("A2").Value)
dte = dte1
For Each sh In ActiveWorkbook.Worksheets
If sh.Name < "Control" And sh.Name < "A" And _
sh.Name < "B" Then
If Month(dte) = Month(dte1) Then
sh.Name = Format(dte, "mmm d")
sh.Visible = xlSheetVisible
dte = dte + 1
Else
sh.Visible = xlSheetHidden
End If
End If
Next sh
Else
MsgBox "Start position invalid"
End If
End Sub

My issue is that I somehow need the code to ignore weekends and holidays
when it renames the sheets. For example, Nov 5 and Nov 6 were Sunday
and Saturday respectively. I would need the code to jump from Nov 4
to Nov 7 etc to account for the weekend.

Any thoughts and suggestions on how to accomplish the above?

Thanks,

Steve


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate A Date Excluding Weekends And Holidays travelersway New Users to Excel 10 February 9th 12 07:34 PM
Calculate End Date (excluding weekends and holidays) guitaronmyback Excel Worksheet Functions 6 May 6th 09 10:17 PM
Calculate A Date Excluding Weekends And Holidays travelersway New Users to Excel 1 February 8th 06 08:56 PM
Workday With Weekends Excluding Holidays Chuy Excel Worksheet Functions 5 January 18th 06 08:04 PM
Formula - Excluding weekends & holidays Connie Martin Excel Worksheet Functions 9 February 25th 05 04:28 AM


All times are GMT +1. The time now is 06:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"