D
Dooza
Hi there,
I have created a Macro that is performing very slowly, its task is this:
Label Cell F2 as Duplicate
Insert Formula into F3 to check if there are duplicates of A3
Copy this formula to all other cells in F
Insert conditional format on F3 to change to red background when cell is
true
Sort sheet by F Desc, A Asc
Here is my macro, can anyone see anything obviously wrong with it? I
made it by recording my actions.
Sub FindDuplicates()
'
' FindDuplicates Macro
' Macro recorded 30/10/2008 by ACLHW103
'
'
Range("F2").Select
ActiveCell.FormulaR1C1 = "Duplicate"
With ActiveCell.Characters(Start:=1, Length:=9).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("F3").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(C[-5],RC[-5])>1"
Range("F3").Select
Selection.Copy
Range("F3:F4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("F3").Select
Application.CutCopyMode = False
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=COUNTIF(A:A,A3)>1"
Selection.FormatConditions(1).Interior.ColorIndex = 3
Selection.Copy
Range("F3:F4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("F3"), Order1:=xlDescending,
Key2:=Range("A3") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1,
MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Application.WindowState = xlMinimized
End Sub
Cheers,
Steve
I have created a Macro that is performing very slowly, its task is this:
Label Cell F2 as Duplicate
Insert Formula into F3 to check if there are duplicates of A3
Copy this formula to all other cells in F
Insert conditional format on F3 to change to red background when cell is
true
Sort sheet by F Desc, A Asc
Here is my macro, can anyone see anything obviously wrong with it? I
made it by recording my actions.
Sub FindDuplicates()
'
' FindDuplicates Macro
' Macro recorded 30/10/2008 by ACLHW103
'
'
Range("F2").Select
ActiveCell.FormulaR1C1 = "Duplicate"
With ActiveCell.Characters(Start:=1, Length:=9).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("F3").Select
ActiveCell.FormulaR1C1 = "=COUNTIF(C[-5],RC[-5])>1"
Range("F3").Select
Selection.Copy
Range("F3:F4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("F3").Select
Application.CutCopyMode = False
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=COUNTIF(A:A,A3)>1"
Selection.FormatConditions(1).Interior.ColorIndex = 3
Selection.Copy
Range("F3:F4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Sort Key1:=Range("F3"), Order1:=xlDescending,
Key2:=Range("A3") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1,
MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Application.WindowState = xlMinimized
End Sub
Cheers,
Steve