I get a type mismatch when trying to use the following in a module:

Sub Copyrowsandpaste(fromsheet As Worksheet, tosheet As Worksheet, Optional col1, Optional crit1)

Dim i As Long
Dim LastRow As Long
Worksheets(fromsheet).Activate
LastRow = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
    If Range(col1 & i) = crit1 Then
        Range("S" & i).EntireRow.Copy Worksheets(tosheet).Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
    End If
Next i
End Sub
The error comes from the "Worksheets(fromsheet).Activate" line, and I suspect it will occur again when I use the tosheet argument. I call this procedure using the line of code:

Copyrowsandpaste Worksheets("wobid"), Worksheets("res"), "S", "Completed"
Where wobid and res are the names of sheets in my workbook. Any ideas why i get the error?

Thank you very much