Stormseed
Banned
- Joined
- Sep 18, 2006
- Messages
- 3,274
Hi everyone
I have this code picked up from a friendly website:
What the code does: This code basically copies all the duplicate records or rows (duplication based in column A) to a new sheet and renames the new sheet with that particular value.
What I need to accomplish: Can this code be modified in order for the code to make it work on more than 85000 rows ?
Well, I can see this code working excellent in situations where the number of rows is less than 5000 ! I tried to execute the code on one of my worksheets of more than 85000 rows and guess what...
my computer got hanged till death
Also, if someone can let me know the limit of making new sheets in a workbook in Excel 2007 ? I have over 9000 unique entries in the source data of over 85000 rows and I guess if I execute the above macro (after being modified) the code would try to create more than 9000 worksheets
Ooooh...this one was given to me as a challenge from my Bossy. He has poured all his arrogance on me all in one single shot
Any help in any form is greatly appreciated !
I have this code picked up from a friendly website:
Code:
Public Sub Extraction_to_new_sheets()
Dim My_Range As Range
Dim My_Cell As Variant
Dim sh_Original As Worksheet
Application.DisplayAlerts = False
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Set sh_Original = ActiveSheet
On Error Resume Next
Sheets("TEMPXXX").Delete
On Error GoTo 0
Worksheets.Add
ActiveSheet.Name = "TEMPXXX"
Worksheets("Sheet1").Columns("A:A").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Columns("A:A"), Unique:=True
Set My_Range = Range("A2:A" & Range("A65536").End(xlUp).Row)
For Each My_Cell In My_Range
On Error Resume Next
Sheets(My_Cell.Value).Delete 'delete if already exists
On Error GoTo 0
Worksheets.Add
ActiveSheet.Name = My_Cell.Value
sh_Original.UsedRange.AutoFilter Field:=1, Criteria1:=My_Cell.Value
sh_Original.Cells.SpecialCells(xlVisible).Copy Destination:=Range("A1")
Columns.AutoFit
Next
Worksheets("TEMPXXX").Delete
sh_Original.AutoFilterMode = False
Set sh_Original = Nothing
Application.DisplayAlerts = True
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
End Sub
What the code does: This code basically copies all the duplicate records or rows (duplication based in column A) to a new sheet and renames the new sheet with that particular value.
What I need to accomplish: Can this code be modified in order for the code to make it work on more than 85000 rows ?
Well, I can see this code working excellent in situations where the number of rows is less than 5000 ! I tried to execute the code on one of my worksheets of more than 85000 rows and guess what...
my computer got hanged till death
Also, if someone can let me know the limit of making new sheets in a workbook in Excel 2007 ? I have over 9000 unique entries in the source data of over 85000 rows and I guess if I execute the above macro (after being modified) the code would try to create more than 9000 worksheets
Ooooh...this one was given to me as a challenge from my Bossy. He has poured all his arrogance on me all in one single shot
Any help in any form is greatly appreciated !