Hi,
I have the below code that keeps giving me an error (Run-Time Error '1004: Metho 'Autofilter' of object 'Range' failed) at this line of code:
This is the full code:
I have the below code that keeps giving me an error (Run-Time Error '1004: Metho 'Autofilter' of object 'Range' failed) at this line of code:
Code:
.Range("A1:AK1").AutoFilter
This is the full code:
Code:
Function topRated()
Dim ws As Worksheet
Dim d, e As Integer
Dim ws5 As Worksheet
Set ws = Sheets("Main")
Set ws5 = Sheets("TopRated")
d = ws.Range("A" & Rows.Count).End(xlUp).Row
ws.Range("AP2:AP" & d).Formula = "=IF(AND(D2<>D1,C2<>C1),""Bold"","""")"
For e = 2 To d
If ws.Cells(e, 42).Value = "Bold" Then
ws.Cells(e, 34).Font.bold = True
ws.Rows(e).Copy
ws5.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
End If
Next
With ws5
.AutoFilterMode = False
.Range("A1:AK1").AutoFilter
.Columns("A:AK").AutoFit
End With
Call conformat2
ws5.Range("B2:B1000").NumberFormat = "DD/MM/YYYY"
ws5.Range("C2:C1000").NumberFormat = "HH:MM:SS"
End Function