Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Need to Speed Up A Macro

I am using the following code for 10 sheets in the same workbook. It works,
but it takes about 4 minutes to run. The 10 spreadsheets contain formulas
which I do not want in the final version. I am performing an advance filter
on each sheet and copying this info to another spreadsheet and copying back
values only to the original spreadsheet. Effective, but very time consuming.
I am using Excel 2003. Any suggestions on how to speed this up?


Sheets("sheet1").Select
Range("A1:D3000").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
Rows("1:3001").Select
Selection.Copy
Sheets("CopyWorkSheet").Select
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=True, Transpose:=False
Sheets("Sheet1").Select
Application.CutCopyMode = False
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Sheets("CopyWorkSheet").Select
Cells.Select
Selection.Copy
Sheets("sheet1").Select

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Need to Speed Up A Macro

Try adding

Application.Screenupdating = False
Application.Calculation = xlCalculationmanual

at the beginning and

Application.Screenupdating = True
Application.Calculation = XLCalculationAutomatic

at the end. If you have any code triggered by events, you'll probably want
to turn that off as well.

HTH,
Barb Reinhardt

"LostInNY" wrote:

I am using the following code for 10 sheets in the same workbook. It works,
but it takes about 4 minutes to run. The 10 spreadsheets contain formulas
which I do not want in the final version. I am performing an advance filter
on each sheet and copying this info to another spreadsheet and copying back
values only to the original spreadsheet. Effective, but very time consuming.
I am using Excel 2003. Any suggestions on how to speed this up?


Sheets("sheet1").Select
Range("A1:D3000").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
Rows("1:3001").Select
Selection.Copy
Sheets("CopyWorkSheet").Select
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=True, Transpose:=False
Sheets("Sheet1").Select
Application.CutCopyMode = False
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Sheets("CopyWorkSheet").Select
Cells.Select
Selection.Copy
Sheets("sheet1").Select

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Need to Speed Up A Macro

Additional to Barb's suggestions which should go a long way to amking things
faster you can remove the slects from your code to add a touch more speed...


with Sheets("sheet1")
.Range("A1:D3000").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
.Rows("1:3001").Copy
Sheets("CopyWorkSheet").Cells.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Sheets("CopyWorkSheet").Cells.Copy
Sheets("sheet1").Select
End With
--
HTH...

Jim Thomlinson


"Barb Reinhardt" wrote:

Try adding

Application.Screenupdating = False
Application.Calculation = xlCalculationmanual

at the beginning and

Application.Screenupdating = True
Application.Calculation = XLCalculationAutomatic

at the end. If you have any code triggered by events, you'll probably want
to turn that off as well.

HTH,
Barb Reinhardt

"LostInNY" wrote:

I am using the following code for 10 sheets in the same workbook. It works,
but it takes about 4 minutes to run. The 10 spreadsheets contain formulas
which I do not want in the final version. I am performing an advance filter
on each sheet and copying this info to another spreadsheet and copying back
values only to the original spreadsheet. Effective, but very time consuming.
I am using Excel 2003. Any suggestions on how to speed this up?


Sheets("sheet1").Select
Range("A1:D3000").AdvancedFilter Action:=xlFilterInPlace, Unique:=True
Rows("1:3001").Select
Selection.Copy
Sheets("CopyWorkSheet").Select
Cells.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=True, Transpose:=False
Sheets("Sheet1").Select
Application.CutCopyMode = False
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Sheets("CopyWorkSheet").Select
Cells.Select
Selection.Copy
Sheets("sheet1").Select

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Speed Up this macro? Joe2007 Excel Programming 20 November 5th 07 07:18 PM
VBA macro speed NTL[_2_] Excel Programming 3 March 5th 07 03:04 PM
Help, need to speed up this macro retseort Excel Discussion (Misc queries) 3 January 12th 06 12:33 PM
Speed-up macro Thomas[_7_] Excel Programming 2 October 2nd 03 05:55 AM
MACRO Speed? Jim[_25_] Excel Programming 2 September 15th 03 03:50 PM


All times are GMT +1. The time now is 12:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"