Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

create copy worksheet and

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Create Copy of Worksheet and Move

Create Copy of Worksheet and Move

ResolvedVersion 2010
Edited on Thu 13 Nov 2014, 12:26

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

Thu 20 Nov 2014: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

How to apply the same formatting and data to multiple sheets at the same time in Excel 2010

When you want to format more than one sheet in a worksheet exactly the same way, Ctrl-click the tabs of the sheets you want to group together and they will all turn white. While they are grouped, anything you enter in one sheet gets entered into the others.

After you have done this, remember to click on the tabs to take them out of the group so that you do not accidentally insert data in multiple sheets when you just want to insert data in one.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.