What am I doing wrong here...

Below is the code of the macro ..
All I want to do is
execute the macro which brings two input box asking the user with the start year and number of years. ie years

I want to match the years with the year in column C from the 'data' worksheet . if the year matches, select that row then I need to check if column B of that row=3. If Col B =3, then paste that row from E:Z and 11 rows below into 'test' workksheet.

In this code, the value of col B=3 is not checked correctly and is pasting wrong values into 'test' worksheet.

Please help.

For i = 1 To Years
'Copy the last worksheet
With ThisWorkbook.Worksheets
.Item(.Count).Copy After:=.Item(.Count)
End With
'Rename the Worksheet with the year
ActiveSheet.Name = "Year1" & Str(StartYear + i - 1)


'Column "A" has Year
Windows("data.xls").Activate
Set Y = ActiveSheet.Range("C:C").Find(StartYear + i - 1)

If Y Is Nothing Then
MsgBox "Year " & YTF & " not found."
Exit Sub
End If
Set RngY = ActiveSheet.Range(Cells(Y.Row, "B").Address, Cells(Y.Row, "Z").Address)
'ActiveSheet is Sheet1
Do Until ActiveSheet.Cells(RngY.Row, "B").Value = 3
Set RngX = ActiveSheet.Range(Cells(RngY.Row, "E").Address, Cells(RngY.Row + 11, "Z").Address)
RngX.Copy

' Destination

Windows("test.xls").Activate
ActiveSheet.Range("C4").PasteSpecial Paste:=xlPasteValues, operation:=xlNone, SkipBlanks _
:=False, Transpose:=True

Exit Do
Loop

Next i