Set sh1 = Worksheets(filenum(lngPosition)).Activate
You are getting Subscript out of range error
error becuase it cannot find that Worksheet.
Also please... please... please do not use .Select/.Activate/Selection/ActiveCell
You might want to see How to Avoid using Select in Excel VBA Macros.