Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Work book with working days only

Hi All,

I Need the code that can generate sheets with date of all the working
days in a month.

Note - Working days are the days between monday and friday.

Thanks
Thyag

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Work book with working days only

here's one way. It will put all week days of the current month in column A.

Sub test()
Dim dtStart As Date
Dim dtEnd As Date
Dim dt As Date
Dim l As Long

dtStart = DateAdd("d", -Day(Date) + 1, Date)
dtEnd = DateAdd("m", 1, dtStart) - 1

dt = dtStart
l = 1
While dt <= dtEnd
If Application.WorksheetFunction.Weekday(dt, 2) < 6 Then
ActiveSheet.Range("A" & l).Value = dt
l = l + 1
End If
dt = dt + 1
Wend

End Sub


--
Hope that helps.

Vergel Adriano


"Thyag" wrote:

Hi All,

I Need the code that can generate sheets with date of all the working
days in a month.

Note - Working days are the days between monday and friday.

Thanks
Thyag


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Work book with working days only

On Aug 21, 12:56 pm, Vergel Adriano
wrote:
here's one way. It will put all week days of the current month in column A.

Sub test()
Dim dtStart As Date
Dim dtEnd As Date
Dim dt As Date
Dim l As Long

dtStart = DateAdd("d", -Day(Date) + 1, Date)
dtEnd = DateAdd("m", 1, dtStart) - 1

dt = dtStart
l = 1
While dt <= dtEnd
If Application.WorksheetFunction.Weekday(dt, 2) < 6 Then
ActiveSheet.Range("A" & l).Value = dt
l = l + 1
End If
dt = dt + 1
Wend

End Sub

--
Hope that helps.

Vergel Adriano



"Thyag" wrote:
Hi All,


I Need the code that can generate sheets with date of all the working
days in a month.


Note - Working days are the days between monday and friday.


Thanks
Thyag- Hide quoted text -


- Show quoted text -


Hi Vergel Adriano,

Well, I really appriciate this.

But I need the same dates to appear as the sheet tab names.
Is this possible....?


Thanks,
Thyag


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Work book with working days only

On Aug 21, 10:04 am, Thyag wrote:
On Aug 21, 12:56 pm, Vergel Adriano





wrote:
here's one way. It will put all week days of the current month in column A.


Sub test()
Dim dtStart As Date
Dim dtEnd As Date
Dim dt As Date
Dim l As Long


dtStart = DateAdd("d", -Day(Date) + 1, Date)
dtEnd = DateAdd("m", 1, dtStart) - 1


dt = dtStart
l = 1
While dt <= dtEnd
If Application.WorksheetFunction.Weekday(dt, 2) < 6 Then
ActiveSheet.Range("A" & l).Value = dt
l = l + 1
End If
dt = dt + 1
Wend


End Sub


--
Hope that helps.


Vergel Adriano


"Thyag" wrote:
Hi All,


I Need the code that can generate sheets with date of all the working
days in a month.


Note - Working days are the days between monday and friday.


Thanks
Thyag- Hide quoted text -


- Show quoted text -


Hi Vergel Adriano,

Well, I really appriciate this.

But I need the same dates to appear as the sheet tab names.
Is this possible....?

Thanks,
Thyag- Hide quoted text -

- Show quoted text -


Thyag:

Try this:
Sub test()
Dim dtStart As Date
Dim dtEnd As Date
Dim dt As Date
Dim l As Long


dtStart = DateAdd("d", -Day(Date) + 1, Date)
dtEnd = DateAdd("m", 1, dtStart) - 1


dt = dtStart
l = 1
While dt <= dtEnd
If Application.WorksheetFunction.Weekday(dt, 2) < 6 Then
ActiveWorkbook.Sheets.Add
After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = Format(dt, "mm-dd-yyyy")
l = l + 1
End If
dt = dt + 1
Wend


End Sub

You can change the format of the sheet names as needed.

HTH,
Jana

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Work book with working days only

On Aug 21, 10:31 am, Jana wrote:
On Aug 21, 10:04 am, Thyag wrote:





On Aug 21, 12:56 pm, Vergel Adriano


wrote:
here's one way. It will put all week days of the current month in column A.


Sub test()
Dim dtStart As Date
Dim dtEnd As Date
Dim dt As Date
Dim l As Long


dtStart = DateAdd("d", -Day(Date) + 1, Date)
dtEnd = DateAdd("m", 1, dtStart) - 1


dt = dtStart
l = 1
While dt <= dtEnd
If Application.WorksheetFunction.Weekday(dt, 2) < 6 Then
ActiveSheet.Range("A" & l).Value = dt
l = l + 1
End If
dt = dt + 1
Wend


End Sub


--
Hope that helps.


Vergel Adriano


"Thyag" wrote:
Hi All,


I Need the code that can generate sheets with date of all the working
days in a month.


Note - Working days are the days between monday and friday.


Thanks
Thyag- Hide quoted text -


- Show quoted text -


Hi Vergel Adriano,


Well, I really appriciate this.


But I need the same dates to appear as the sheet tab names.
Is this possible....?


Thanks,
Thyag- Hide quoted text -


- Show quoted text -


Thyag:

Try this:
Sub test()
Dim dtStart As Date
Dim dtEnd As Date
Dim dt As Date
Dim l As Long

dtStart = DateAdd("d", -Day(Date) + 1, Date)
dtEnd = DateAdd("m", 1, dtStart) - 1

dt = dtStart
l = 1
While dt <= dtEnd
If Application.WorksheetFunction.Weekday(dt, 2) < 6 Then
ActiveWorkbook.Sheets.Add
After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = Format(dt, "mm-dd-yyyy")
l = l + 1
End If
dt = dt + 1
Wend

End Sub

You can change the format of the sheet names as needed.

HTH,
Jana- Hide quoted text -

- Show quoted text -


Please note that the line beginning with After:= wrapped to the next
line in my post.

Jana



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Work book with working days only

On Aug 21, 1:34 pm, Jana wrote:
On Aug 21, 10:31 am, Jana wrote:





On Aug 21, 10:04 am, Thyag wrote:


On Aug 21, 12:56 pm, Vergel Adriano


wrote:
here's one way. It will put all week days of the current month in column A.


Sub test()
Dim dtStart As Date
Dim dtEnd As Date
Dim dt As Date
Dim l As Long


dtStart = DateAdd("d", -Day(Date) + 1, Date)
dtEnd = DateAdd("m", 1, dtStart) - 1


dt = dtStart
l = 1
While dt <= dtEnd
If Application.WorksheetFunction.Weekday(dt, 2) < 6 Then
ActiveSheet.Range("A" & l).Value = dt
l = l + 1
End If
dt = dt + 1
Wend


End Sub


--
Hope that helps.


Vergel Adriano


"Thyag" wrote:
Hi All,


I Need the code that can generate sheets with date of all the working
days in a month.


Note - Working days are the days between monday and friday.


Thanks
Thyag- Hide quoted text -


- Show quoted text -


Hi Vergel Adriano,


Well, I really appriciate this.


But I need the same dates to appear as the sheet tab names.
Is this possible....?


Thanks,
Thyag- Hide quoted text -


- Show quoted text -


Thyag:


Try this:
Sub test()
Dim dtStart As Date
Dim dtEnd As Date
Dim dt As Date
Dim l As Long


dtStart = DateAdd("d", -Day(Date) + 1, Date)
dtEnd = DateAdd("m", 1, dtStart) - 1


dt = dtStart
l = 1
While dt <= dtEnd
If Application.WorksheetFunction.Weekday(dt, 2) < 6 Then
ActiveWorkbook.Sheets.Add
After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = Format(dt, "mm-dd-yyyy")
l = l + 1
End If
dt = dt + 1
Wend


End Sub


You can change the format of the sheet names as needed.


HTH,
Jana- Hide quoted text -


- Show quoted text -


Please note that the line beginning with After:= wrapped to the next
line in my post.

Jana- Hide quoted text -

- Show quoted text -


This is really wonder ful.

I just want a small modification for this.
Can I generate the same sheets for any specified month.

Thanks,
Thyag.

Reply
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 working days but change working week SamB Excel Discussion (Misc queries) 1 September 1st 08 09:17 PM
Making weekend days working days - the system cuts the working tim Fluffy Excel Discussion (Misc queries) 1 May 30th 08 10:02 PM
How to calculation no. of days (only working days) between two dat Vivian Chan Excel Discussion (Misc queries) 1 July 26th 07 09:16 AM
Is there away to keep "auto save" from jumping to the first work sheet in the work book? Marc New Users to Excel 2 April 21st 05 01:27 AM
simultaneously work in a work book with other users Sweets Excel Discussion (Misc queries) 1 April 18th 05 07:35 PM


All times are GMT +1. The time now is 03:34 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"