Now this works fine if the sheet name (strName) I pass is the active sheet. However, if it is not, it crashes at the "wks.Range(wks.Rows" line with the message: Select method of Range class failed.
I can not seem to see what is wrong. Any clues?

I have checked the parameters and strName is the name of a valid sheet and lngRow contains the value 2.