Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Holidays list in a function

Happy Holidays everyone!
And speaking of which . . . I'm using a Holiday
function that I may have gotten from this group . . .

Public Function IsHoliday(CheckDate, Holidays As Range) As Boolean
'Return Trues if the day, dateTime, is in Holidays List
Dim c As Range
For Each c In Holidays
If DateValue(CheckDate) = c Then
IsHoliday = True
Exit Function
End If
Next c
IsHoliday = False
End Function

The Holidays List is on a sheet in PERSONAL.XLS
The only tiny hitch is that when I use the function it
prompts for the Holidays argument but since this
is always going to be in the same place I would like
this to be automatic. Is that possible by perhaps
including its path in the function?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,726
Default Holidays list in a function

Public Function IsHoliday(CheckDate) As Boolean
'Return Trues if the day, dateTime, is in Holidays List
Dim c As Range
For Each c In
Workbooks("Personal.xls").Worksheets("holidays").R ange("A1:A10")
If DateValue(CheckDate) = c Then
IsHoliday = True
Exit Function
End If
Next c
IsHoliday = False
End Function


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
"John Pierce" wrote in message
ups.com...
Happy Holidays everyone!
And speaking of which . . . I'm using a Holiday
function that I may have gotten from this group . . .

Public Function IsHoliday(CheckDate, Holidays As Range) As Boolean
'Return Trues if the day, dateTime, is in Holidays List
Dim c As Range
For Each c In Holidays
If DateValue(CheckDate) = c Then
IsHoliday = True
Exit Function
End If
Next c
IsHoliday = False
End Function

The Holidays List is on a sheet in PERSONAL.XLS
The only tiny hitch is that when I use the function it
prompts for the Holidays argument but since this
is always going to be in the same place I would like
this to be automatic. Is that possible by perhaps
including its path in the function?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 93
Default Holidays list in a function

Thanks, Bob, that did the trick.

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
using pulldown list with a list and autocompleet function Peter Jonkers Excel Worksheet Functions 4 September 9th 09 09:25 AM
Holidays JB Excel Worksheet Functions 2 January 10th 07 12:27 PM
help to build a list of holidays for 6 years dribler2 Excel Worksheet Functions 16 December 31st 06 04:56 PM
holidays bamboozled Excel Discussion (Misc queries) 4 May 29th 06 04:08 PM
Adding a custom function to the default excel function list DonutDel Excel Programming 3 November 21st 03 03:41 PM


All times are GMT +1. The time now is 06:54 AM.

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"