untitledf.jpguntitled.JPG

Hi,

Still having problems :/ I have attached screenshots. I would like a user to enter dates where they would like to check availability for, and hit search to return the results in the to the cells in Sheet1. Sheet2 contains the data, which is only test data at the moment however this will be around 1000 dates.

My code at the moment stands

Sub CommandButton1_Click()

Dim r As Range, ws As Worksheet, M As Date, Y As Date, C As Range, d As Long

M = Range("F7")
Y = Range("G7")


d = 2

Set ws = Worksheets("Sheet2")
Set C = ws.Range("C1:C18" & ws.Range("C" & Rows.Count).End(xlUp).Row)

For Each r In C

    If Month(r) = M And Year(r) = Y Then
       
        Worksheets("Sheet2").Range("A1" & r.Row & ":D" & r.Row).Copy Cells(d, 3)
        d = d + 1

    End If

Next

End Sub
I am going terribly wrong somewhere and just cannot seem to get my head around it. Any help would be greatly appreciated as I would like to present on Friday to my boss :/

Thanks !