Macro runs on Windows not Mac

Status
Not open for further replies.

Trotter

New Member
Joined
May 2, 2020
Messages
8
Office Version
  1. 2016
Platform
  1. Windows
  2. MacOS
DanteAmor was kind enough to provide the following macro to highlight duplicates and triplicates. It works on the Windows platform but not on MacOS.

On the MacOS it gets stuck on the line: Set dic1 = CreateObject(“Scripting.Dictionary”) and gives:

Run-time error ‘429’

ActiveX component cant’ create object


DanteAmore’s Macro is:


Sub Duplicates_3()

Dim c As Range, r As Range

Dim dic1 As Object, dic2 As Object

Dim j As Variant, ky As Variant



Application.ScreenUpdating = False

Set r = ActiveSheet.Range("C7:C12,J7:J12,Q7:Q12")

Set dic1 = CreateObject("Scripting.Dictionary")

Set dic2 = CreateObject("Scripting.Dictionary")



r.Interior.ColorIndex = 19

r.Font.Color = vbBlack



For Each c In r

dic2(c.Address) = c.Value

For j = c.Value - 4 To c.Value + 4

dic1(j) = dic1(j) + 1

Next

Next

'

For Each ky In dic2.keys

j = dic1(dic2(ky))

Select Case j

Case 2

Range(ky).Interior.ColorIndex = 3

Range(ky).Font.Color = vbWhite

Case Is >= 3

Range(ky).Interior.ColorIndex = 10

Range(ky).Font.Color = vbWhite

Case 4

'...

End Select

Next

End Sub



The Microsoft Support Website says the error message is because “the Automation object is unavailable to Visual Basic.”

Is there a way round this, or does it have to be rewritten for a Mac format?

I have tried various versions based on the above macro combined with my original macro that gives duplicates with a problem with triplicates without success.



I have Excel 16.37 on my Mac.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Duplicate Highlighting duplicates and triplicates

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,213,561
Messages
6,114,315
Members
448,564
Latest member
ED38

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