Mark has attended:
Excel VBA Intro Intermediate course
Excel Advanced - For Power Users course
Excel PowerPivot course
Excel Dashboards for Business Intelligence course
Create Copy of Worksheet and Move
Hi,
I'm trying to create a copy of an existing worksheet and insert it into a different workbook which I'm referring to using a dim as string, I can't however get the VBA to work. Any suggestions?
Dim Site As String
Site = Sheets("2014-20 Based on 2013 (3)").Range("F3").Value & ".xlsm"
Workbooks.Open filename:="G:\Network Operations Team\2014\MBPC\Network Capacity\StockTurn.xlsx"
Sheets("Sheet1").Select
Sheets("Sheet1").Copy After:=(Site.Sheet(13))
Thanks,
Mark
RE: Create Copy of Worksheet and Move
Hi Mark,
Thank you for the forum question.
The only problem you have in the code is how you refer to the destination workbook.
Try the code below:
Dim Site As String
Site = Sheets("2014-20 Based on 2013 (3)").Range("F3").Value & ".xlsm"
Workbooks.Open filename:="G:\Network Operations Team\2014\MBPC\Network Capacity\StockTurn.xlsx"
Sheets("Sheet1").Select
Sheets("Sheet1").Copy After:=workbooks(Site).Sheet(13)
Please let me know if this is not working for you.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector