ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   worksheet funtion help (https://www.excelbanter.com/excel-discussion-misc-queries/98588-worksheet-funtion-help.html)

Richard

worksheet funtion help
 
I understand that this goes in the vb code but I don't understand on how to
make it work. All my formulas for my holidays are in the form of Worksheet
Formulas on Sheet3, Column A. How would I add this formula to say Sheet3,
cell A26.
Public Function ThanksgivingDate(Yr As Integer) As Date
ThanksgivingDate = DateSerial(Yr, 11, 29 - _
WeekDay(DateSerial(Yr, 11, 1), vbFriday))
End Function
Thanks in advance!!!


Toppers

worksheet funtion help
 
in A26:

=ThanksgivingDate(2006)

or

=ThanksgivingDate(X1) where x1=2006

Format A26 as Date.

HTH

"Richard" wrote:

I understand that this goes in the vb code but I don't understand on how to
make it work. All my formulas for my holidays are in the form of Worksheet
Formulas on Sheet3, Column A. How would I add this formula to say Sheet3,
cell A26.
Public Function ThanksgivingDate(Yr As Integer) As Date
ThanksgivingDate = DateSerial(Yr, 11, 29 - _
WeekDay(DateSerial(Yr, 11, 1), vbFriday))
End Function
Thanks in advance!!!


Bob Phillips

worksheet funtion help
 
You simply type

=ThanksGivingDate(year)

in the cell.

All it does is return the date of ThanksGivingDay for the nominated year.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Richard" wrote in message
...
I understand that this goes in the vb code but I don't understand on how

to
make it work. All my formulas for my holidays are in the form of

Worksheet
Formulas on Sheet3, Column A. How would I add this formula to say Sheet3,
cell A26.
Public Function ThanksgivingDate(Yr As Integer) As Date
ThanksgivingDate = DateSerial(Yr, 11, 29 - _
WeekDay(DateSerial(Yr, 11, 1), vbFriday))
End Function
Thanks in advance!!!





All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com