Forum Discussion

farhansaleem's avatar
farhansaleem
Copper Contributor
May 28, 2019
Solved

Data Extraction

Hi, I have some data arranged in Year, Month, Day format. I want to extract the common numbers of days (respective to month and year) from the 4 data sets.  I have also attached the excel fil...
  • Berndvbatanker's avatar
    May 28, 2019

    farhansaleem 

    Hi, i hope that I have understood the task. You want to check if a date is on monday to friday?

    I write an userdefined function, see attached file, too.

     

    Function commonDays(strYear As String, strMonth As String, strDay) As Boolean
    Dim dteDate As Date

    dteDate = DateSerial(strYear, strMonth, strDay)

    If Application.WorksheetFunction.Weekday(dteDate, vbMonday) < 6 Then
    commonDays = True

    Else

    commonDays = False

    End If

    End Function

    Regards from germany

    Bernd

    http://www.vba-Tanker.com

     

Resources