excel in courses - a copying sheets existing
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » excel in courses - A) Copying sheets to an existing file and B) Exporting Two Sheet

excel in courses - A) Copying sheets to an existing file and B) Exporting Two Sheet

resolvedResolved · Low Priority · Version Standard

replyReplyFri 18 Jan 2008, 14:21Delegate Michele said...

A) Copying sheets to an existing file and B) Exporting Two Sheet

Hi,

I hope you will be able to help me. I am writing a collection of queries to:

i) Rename Worksheets in 2 workbooks (done)
ii) Copy worksheets from one file to the other (see query below)
iii) Sort sheets alphabetically (done)
iv) Separate out 2 sheets at a time and save as new workbook (see query below)

Please can you let me know how I can amend the following MACROs:

ii) - This MACRO needs to copy the worksheets from 3 to 15 into the workbook "T:\INFO\general\Adhocs\Michele\West Essex PCT\ Q2 Epping Locality PbC PBR Detail.xls" - this file already exists. The MACRO below falls over at "ActiveSheet.Move..." (if I remove this line, the sheets are copied to a new workbook):

Sub CopySheetsToDetailEpp()
'
Dim SheetName As String

Application.ScreenUpdating = False

Sheets("Summary WEPCT").Select

NoSheets = 15

For i = 3 To NoSheets

Sheets(i).Activate
Sheets(i).Copy
ActiveSheet.Move "T:\INFO\general\Adhocs\Michele\West Essex PCT\ Q2 Epping Locality PbC PBR Detail.xls"

Next i

Sheets("Summary WEPCT").Select

End Sub

iv) As I have already sorted my workbook, I need to copy the first and second sheets and save them as a new file, then the third and fourth and so on. The MACRO below only separates one sheet at a time, I have tried inserting (i)+1 a number of ways, but cannot seem to get the code right. Please see MACRO below:

Sub Export_Sheets()

Application.ScreenUpdating = False

Dim NoSheets As Integer
Dim i As Integer

CurrentMonth = InputBox("Enter Current Quarter for Report (e.g. Q2)")

NoSheets = 30

For i = 1 To NoSheets
Sheets.Select
Sheets(i).Activate
ActiveSheet.Copy
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("C1").Select
ActiveWorkbook.SaveAs Filename:="T:\INFO\general\Adhocs\Michele\West Essex PCT\PBR\" _
& "PBR Report for " & ActiveSheet.Name & " " & CurrentMonth & ".xls"
ActiveWorkbook.Close
Next i

Sheets("Summary WEPCT").Select

End Sub

I would be really grateful if you would be able to suggest ways of fixing these MACROs.

Many thanks in advance,
Michele

For upcoming training course dates see: Pricing & availability

 

 

Excel tip:

Checking if a calculation adheres to Order of Precedence

When writing formulas you must make sure that results will be calculated as you intended.

Excel adheres to the standard order of precedence for calculations. It calculates percentages, exponents, multiplication, and division in this order before calculating addition and subtraction.

For example, =7+5*3 results in an answer of 22, not 36.

To force a calculation to be completed before another calculations, place the section in parentheses: =(7+5)*3 will result in 36.

To check how excel is evaluating a formula, click on the cell and select the 'Tools' menu, select 'Formula Auditing' and click 'Evaluate Formula'

In the dialog box click on 'Evaluate' to watch as each part of the formula is successively calculated.

View all Excel hints and tips


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training