An Introduction to Excel VBA Programming: with Applications in Finance and Insurance by Guojun Gan

An Introduction to Excel VBA Programming: with Applications in Finance and Insurance by Guojun Gan

Author:Guojun Gan [Gan, Guojun]
Language: eng
Format: azw3, epub
Publisher: CRC Press
Published: 2017-05-08T04:00:00+00:00


2

 Dim iWd As Integer

3

 iWd = Weekday (datIn)

4

 If iWd = vbSaturday Or iWd = vbSunday Then

5

  IsWeekend = True

6

 Else

7

  IsWeekend = False

8

 End If

9

End Function

The function IsWeekend returns true if the input date is a weekend. We can test this function as follows:

1

Sub TestIsWeekend ()

2

 Dim i As Integer

3

 For i = 1 To 7

4

  Debug . Print IsWeekend (DateSerial (2016, 5, i)) & " ";

5

 Next i

6

End Sub

Executing the above sub procedure gives

1

True False False False False False True



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.