ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Working out the start day, for a particular month and year (https://www.excelbanter.com/excel-programming/409262-working-out-start-day-particular-month-year.html)

NateBuckley

Working out the start day, for a particular month and year
 
Hello everyone,

A little bit stuck, I'm just wondering if anyone knows a way how I'd be able
to work out the 1st Day of a particular month, of a particular year.

So If I did the following

aString = WhatsTheDay(1, 2010)

the function "WhatsTheDay" would return "Fri" or "Friday"

Thanks for any help in advance!





Gary''s Student

Working out the start day, for a particular month and year
 
Function WhatsTheDay(mnth As Integer, yr As Integer) As String
whatday = Format(DateSerial(yr, mnth, 1), "dddd")
End Function

--
Gary''s Student - gsnu200778

Gary''s Student

Working out the start day, for a particular month and year
 
sorry:

Function WhatsTheDay(mnth As Integer, yr As Integer) As String
WhatsTheDay = Format(DateSerial(yr, mnth, 1), "dddd")
End Function
--
Gary''s Student - gsnu200778


"Gary''s Student" wrote:

Function WhatsTheDay(mnth As Integer, yr As Integer) As String
whatday = Format(DateSerial(yr, mnth, 1), "dddd")
End Function

--
Gary''s Student - gsnu200778


NateBuckley

Working out the start day, for a particular month and year
 
You sir, deserve a Pint of cold beer.

Thank you so much, I've been looking at a lot more complicated examples. I
feel a bit of a dummy now.

Thanks again!

"Gary''s Student" wrote:

sorry:

Function WhatsTheDay(mnth As Integer, yr As Integer) As String
WhatsTheDay = Format(DateSerial(yr, mnth, 1), "dddd")
End Function
--
Gary''s Student - gsnu200778


"Gary''s Student" wrote:

Function WhatsTheDay(mnth As Integer, yr As Integer) As String
whatday = Format(DateSerial(yr, mnth, 1), "dddd")
End Function

--
Gary''s Student - gsnu200778


Gary''s Student

Working out the start day, for a particular month and year
 
You are very welcome.
Have a pleasant day!
--
Gary''s Student - gsnu200778


"NateBuckley" wrote:

You sir, deserve a Pint of cold beer.

Thank you so much, I've been looking at a lot more complicated examples. I
feel a bit of a dummy now.

Thanks again!

"Gary''s Student" wrote:

sorry:

Function WhatsTheDay(mnth As Integer, yr As Integer) As String
WhatsTheDay = Format(DateSerial(yr, mnth, 1), "dddd")
End Function
--
Gary''s Student - gsnu200778


"Gary''s Student" wrote:

Function WhatsTheDay(mnth As Integer, yr As Integer) As String
whatday = Format(DateSerial(yr, mnth, 1), "dddd")
End Function

--
Gary''s Student - gsnu200778


Rick Rothstein \(MVP - VB\)[_1711_]

Working out the start day, for a particular month and year
 
Just as a follow up.... if one doesn't, or doesn't want to, remember the
"dddd" argument, there is an alternative set of formulas available.

Function WhatsTheDay(mnth As Integer, yr As Integer) As String
WhatsTheDay = WeekdayName(Weekday(DateSerial(yr, mnth, 1)))
End Function

Rick


"Gary''s Student" wrote in message
...
sorry:

Function WhatsTheDay(mnth As Integer, yr As Integer) As String
WhatsTheDay = Format(DateSerial(yr, mnth, 1), "dddd")
End Function
--
Gary''s Student - gsnu200778


"Gary''s Student" wrote:

Function WhatsTheDay(mnth As Integer, yr As Integer) As String
whatday = Format(DateSerial(yr, mnth, 1), "dddd")
End Function

--
Gary''s Student - gsnu200778




All times are GMT +1. The time now is 04:21 AM.

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