Hi everyone, this script is supposed to compare two ranges and in case of no match replace cells with text. Im quite new to VBA and when I usually write a script, it performs poorly on big data sets. Is there any way, how to make this work faster? I have tried Application.ScreenUpdating = False, but it doesnt work.
Thank you in advance!
Code:
Sub RangeCompare()
Dim Range1 As Range, Range2 As Range, c As Range
On Error Resume Next
Set Range1 = ActiveWorkbook.Sheets("Master Slide").Range("a4:a90")
Set Range2 = Application.InputBox("Select Range2:", Title:="Get Range2", Type:=8)
On Error GoTo 0
For Each c In Range2.Cells
If Len(c) > 0 Then
If Application.WorksheetFunction.CountIf(Range1, c.Value) = 0 Then
c.Formula = "Others"
End If
End If
Next c
End Sub