When I enter a value in A6 of sheet Booking,
I am getting a Type Mismatch error on the line : selectedMonth = Month(monthValue) ' Extract month number
in the following VBA code.
' Check if the changed cell is A6
If Target.CountLarge > 1 Then Exit Sub
If Not Intersect(Target, wsBooking.Range("A6")) Is Nothing Then
ThisWorkbook.Sheets("Booking").Unprotect Password:="edit"
Application.EnableEvents = False
ThisWorkbook.Sheets("Booking").Range("N2:Q40").ClearContents
Dim wsTargetAsset As Worksheet
Set wsTargetAsset = ThisWorkbook.Worksheets(wsBooking.Range("A2").Value)
    ' Clear previous formatting
    'wsBooking.Range("D2:J36" & wsBooking.Cells(wsBooking.Rows.Count, "D").End(xlUp).Row).Interior.ColorIndex = xlNone
' Use Union to combine the specified ranges
    Dim targetRangeA6 As Range
    Set targetRangeA6 = Union(wsBooking.Range("D3:J8"), _
                            wsBooking.Range("D10:J15"), _
                            wsBooking.Range("D17:J22"), _
                            wsBooking.Range("D24:J29"), _
                            wsBooking.Range("D31:J36"))
    ' Set the interior color of the combined range to none
    targetRangeA6.Interior.ColorIndex = xlNone

    ' Get the selected value from A6
    selectedValue3 = wsBooking.Range("A6").Value

    ' Find the column in 'WF Assets' corresponding to the selected value
    Set foundColumn = wsTargetAsset.Rows(1).Find(What:=selectedValue3, LookIn:=xlValues, LookAt:=xlWhole)

    If Not foundColumn Is Nothing Then
        colIndex = foundColumn.Column

        ' Loop through each month-year in column C of 'Booking'
        For Each cell In wsBooking.Range("C2:C" & wsBooking.Cells(wsBooking.Rows.count, "C").End(xlUp).Row)
            monthValue = cell.Value ' This should be like "mmm yy"
            selectedMonth = Month(monthValue) ' Extract month number
            selectedYear = Year(monthValue) ' Extract year number

            ' Determine the cell range for the days of the month in the corresponding month (from D to J)
            Set monthCol = wsBooking.Range(wsBooking.Cells(cell.Row, 4), wsBooking.Cells(cell.Row, 10)) ' D to J
            
            ' Loop through each day cell in the month range D to J
            For Each dayCell In monthCol
                ' Check if the day cell is a date or numeric
                If Not IsEmpty(dayCell.Value) And (IsNumeric(dayCell.Value) Or IsDate(dayCell.Value)) Then
                    ' Convert the day cell value to a date if necessary
                    If Not IsDate(dayCell.Value) Then
                        dayDate = DateSerial(selectedYear, selectedMonth, CLng(dayCell.Value))
                    Else
                        dayDate = dayCell.Value
                    End If

                    dayValue = Day(dayDate) ' Extract just the day

                    ' Compare with the found column in 'WF Assets'
                    lastRow3 = wsTargetAsset.Cells(wsTargetAsset.Rows.count, colIndex).End(xlUp).Row

                    For startRow2 = 2 To lastRow3
                        ' Get the asset date
                        Dim assetsDate As Date
                        assetsDate = wsTargetAsset.Cells(startRow2, colIndex).Value

                        ' Checking both day, month, and year
                        If Day(assetsDate) = dayValue And Month(assetsDate) = selectedMonth And Year(assetsDate) = selectedYear Then
                            ' Highlight the matching date in the Booking sheet
                            dayCell.Interior.Color = RGB(255, 0, 0) ' Red Color
                        End If
                    Next startRow2
                End If
            Next dayCell
        Next cell
    Else
        MsgBox "Selected item not found in 'WF Assets' headers."
    End If
        wsBooking.Range("A8").ClearContents
        wsBooking.Range("A10").ClearContents
        wsBooking.Range("A12").ClearContents
        wsBooking.Range("A14:A25").ClearContents
        wsBooking.Range("A27").ClearContents
        Application.EnableEvents = True
        ThisWorkbook.Sheets("Booking").Protect Password:="edit"
        Call Module6.LoadLiveBookings
End If