xcellrodeo
Board Regular
- Joined
- Oct 27, 2008
- Messages
- 206
Hello MrExcel Community I have an issue with a VBA script. I am trying to copy a spreadsheet from one workbook to a new user-defined Workbook. The script I have is as follows:
However, this doesn't work.Btw, T2 refers to an input box where the new file name is declared i.e Region 1.xlsm (but file names are can change). Also I am having trouble determining the correct code for copying the worksheet into the correct position in the new workbook.At present it overwrites whatever is on the 1st sheet in the new workbook. Ideally I would want the script to be modified so that the worksheet is copied into the new workbook at the very front of whatever tabs /sheets are there (i.e not overwriting them).Hope this helps.Any help is greatly appreciated.
Code:
Workbooks("CART2013.xlsm").Activate
Sheets("Sales By Month").Select
Sheets("Sales By Month").Copy Before:=Workbooks("&T2&.xlsm").Sheets(1)