View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
chrismv48 chrismv48 is offline
external usenet poster
 
Posts: 11
Default More efficient code than this?

Hello all,

I recorded this macro using Excel's Macro Recorder and making tweaks
afterwards. After reading up on VBA I have a feeling that the code is
probably bloated with unecessary commands/lines. It also runs fairly slow on
my computer.

What the macro does is copy a worksheet to a new book, copies that whole
sheet and pastes special as values. Then it does a save as and closes...

Sub Macro1()

Sheets("Invoice").Select
Sheets("Invoice").Copy
Cells.Select
Range("C11").Activate
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

ActiveWorkbook.SaveAs "C:\Documents and Settings\GIT " & Range("G8") & ".xls"
ActiveWorkbook.Close
End Sub