My code not working on a MAC

BrianG86

Board Regular
Joined
Nov 12, 2013
Messages
135
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:

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
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,214,813
Messages
6,121,706
Members
449,049
Latest member
THMarana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top