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

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.


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.worksheet.functions
external usenet poster
 
Posts: 20
Default Need to Speed Up A Code

Sorry...This should've been posted in Excel Programming Section.

"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.


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.worksheet.functions
external usenet poster
 
Posts: 703
Default Need to Speed Up A Code

Hi

I think this is what you need. I suspect you want to delete data from
Sheet1 before you paste the unique data, though I cant see it from
your code snippet. If that is the case it should be done before the
line: shB.Cells.Copy Destination:=shA.Range("A1")



Sub foo()
Dim shA As Worksheet
Dim shB As Worksheet
Application.ScreenUpdating = False
Set shB = Worksheets("CopyWorkSheet")
For Each shA In ThisWorkbook.Worksheets
If shA.Name < shB.Name Then
Set shA = Worksheets("sheet1")
With shA
.Range("A1:D3000").AdvancedFilter _
Action:=xlFilterInPlace, Unique:=True
.Rows("1:3001").Copy
End With

shB.Range("A1").PasteSpecial Paste:= _
xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, Transpose:=False
Application.CutCopyMode = False
On Error Resume Next
shA.ShowAllData
On Error GoTo 0
shB.Cells.Copy Destination:=shA.Range("A1")
End If
Next
Application.ScreenUpdating = True
End Sub

Hopes this helps.
....
Per

On 20 Jul., 18:50, 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.

*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 Issue Stephgill Excel Discussion (Misc queries) 0 October 9th 08 12:01 PM
VBA Speed up sparx Excel Discussion (Misc queries) 2 April 29th 06 04:59 PM
Can you speed UP drag speed? Ryan W Excel Discussion (Misc queries) 1 October 24th 05 06:09 PM
How can I speed up calulations Andrew C Excel Discussion (Misc queries) 3 September 22nd 05 09:50 PM
I need mor Speed!!!! MESTRELLA29 Excel Discussion (Misc queries) 0 February 11th 05 02:51 PM


All times are GMT +1. The time now is 04:13 PM.

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

About Us

"It's about Microsoft Excel"