It appears that the variable "shArray(i)" is null. Thus your type mismatch error.

FYI, adding "MsgBox shArray(i)" after "x = shArray" displays an empty message box.