I'd be surprised if there's a bug in the code since it works OK for me.
Would you check that you do have a sheet with a VBA name 'Sheet2' that contains your original data. i.e. not just a sheet whose tab name says 'Sheet2' which may not necessarily be the VBA Sheet2. In the VBA Project explorer window the VBA sheet name is the first mentioned, followed in brackets by the tab name. I suspect whilst you might have a sheet named Sheet2 it's VBA name is some other number.
Alternatively, you could change the line of offending code to the following. Assuming the sheet where you want the new layout to appear has a tab name say "New"
HTH
Bookmarks