new Type mismatch error

new Type mismatch error

I've been using this macro successfully for some time and when I ran it today it suddenly gives a type mismatch error on line 8.

  1. Sub Randomcise2()
  2. Dim i as Integer
  3. Dim numSheets as Integer
  4. Dim thisRandom as Integer
  5. numSheets = ActiveWorkbook.Worksheets.Count
  6. Randomize
  7. For i = 5 To numSheets
  8.     thisRandom = WorksheetFunction.RandBetween(5, numSheets)
  9.     Worksheets(5).Move Before:=ThisWorkbook.Sheets(thisRandom)
  10. Next i