I keep getting a Subscript out of range error on this part of code. I know it works as I've used the code in other things and recording a macro gives almost the exact code.
Any idea what might be happening?
Code:
OldWorkbookName = ActiveWorkbook.Name
Workbooks.Add
NewWorkbookName = ActiveWorkbook.Name
Windows(OldWorkbookName).Activate
Selection.Cut 'Selection is made else where in the code
Windows(NewWorkbookName).Activate 'This line is the error
Range("A1").Select
ActiveSheet.Paste
Any idea what might be happening?