So this is my code:
Option Explicit
Sub Check_Transactions2()
Dim QrtID() As Range
Dim Missing() As Range
Dim a, b As Range
Dim w, x, p, r As Variant
Dim i, iRw As Integer
Application.ScreenUpdating = False
r = Worksheets("Transac Check").Range("D1").Value
i = 0
Set b = Worksheets(r).Range("H4:H" & Worksheets(r).Range("I1"))
For Each x In b
i = i + 1
ReDim Preserve QrtID(1 To i)
QrtID(i) = x.Value
Next x
i = 0
For Each p In QrtID
If Application.WorksheetFunction.CountIf(Worksheets("Transactions").Range("W4:W" & Worksheets("Transactions").Range("X1").Value), p.Value) = 0 Then
i = i + 1
ReDim Preserve Missing(1 To i)
Missing(i) = p.Value
End If
Next p
For iRw = LBound(Missing) To UBound(Missing)
Worksheets("Transac Check").Cells(iRw + 1, 15).Value = Missing(iRw)
Next iRw
Application.ScreenUpdating = True
End Sub
When I get to the line
QrtID(i) = x.Value
I receive the "object variable or with block variable not set" error, and I can't really figure out why. Would appreciate any help.
Dim QrtID() As RangetoDim QrtID() As VAriantSet QrtID(i) = x