View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bill Renaud[_2_] Bill Renaud[_2_] is offline
external usenet poster
 
Posts: 117
Default How do I format a sheet using a copy macro?

As a quick suggestion, in this case, copy the entire worksheet to a new
workbook using the following basic procedure (turn on the macro recoder,
then edit the recorded code when done):

1. Open a new workbook.
2. Activate the original workbook.
3. Arrange the windows vertically side-by-side.
4. Hold down the Ctrl key, then drag the worksheet to be copied to the new
empty workbook.
5. Select all cells on the newly copied worksheet in the new workbook (click
on the blank area right above the first row number and left of the first
column label).
6. Copy data.
7. PasteSpecial Values. This will eliminate any links back to the source
workbook.
8. Delete any empty worksheets in the new workbook.
9. Save the workbook with a new name.

This way, all of the formatting, including page setups, will already be
included. Also, all objects (including any embedded charts) should also copy
.. Leave out the 30 or so lines of code to set the PageSetup properties
(LeftMargin, TopMargin, LeftHeader, etc.). The PageSetup properties have
always been slow in VBA (at least up to Excel 2000), and seem to take about
1 second for each one.

Also, I don't think you will need to turn Automatic Calculation off for this
macro, as it won't really save any measurable time.
--
Regards,
Bill