salt_wagonner
New Member
- Joined
- Mar 10, 2023
- Messages
- 6
- Office Version
- 365
- Platform
- MacOS
I'm having trouble figuring out what's going on with my macro. I want to copy down a formula that identifies non-consecutive duplicate cells, but when I run the macro I get an "application-defined or object-defined error" message. I know the formula works as-written, because when I manually enter and copy it down it works as expected. I also know the macro works in terms of copying down formulas, because it works fine with other simple formulas. It's something specific to this formula that just won't work.
The values I'm checking are in column C, and I am trying to insert the formula in Column U.
Any help would be appreciated!
The values I'm checking are in column C, and I am trying to insert the formula in Column U.
Any help would be appreciated!
VBA Code:
Sub CopyDuplicateFormula()
S_Data.Activate
LR = S_Data.Cells(Rows.Count, "C").End(xlUp).Row
S_Data.Range("U2:U" & LR).Select
Selection.FormulaR1C1 = "=LET(a,C2=$C$2:$C$6915,b,a*SEQUENCE(ROWS(a)),c,FILTER(b,b>0),d,ROWS(c),e,INDEX(c,1)+d-1,f,INDEX(c,d),IF(f<>e,TRUE,FALSE))"
End Sub