gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,347
- Office Version
- 365
- Platform
- Windows
I have code that was running great for more than a year. Now its adding in the formula as text so its not doing the calculation any longer
"=IFERROR((INDEX(Detail!C[-2],MATCH(CMOP!RC[-1],Detail!C[-2],0))),""DELETE"")"
Any help is appreciated
"=IFERROR((INDEX(Detail!C[-2],MATCH(CMOP!RC[-1],Detail!C[-2],0))),""DELETE"")"
Any help is appreciated
Code:
Sub StripDown()
'
' Macro1 Macro
'
If Not Evaluate("isref('CMOP'!a1)") Then
MsgBox "You Did not import the CMOP"
UserForm1.Hide
'CMOP.Close False
Exit Sub
Else
Dim LstRw As Long
'
Sheets("CMOP").Select
LstRw = Sheets("CMOP").Range("B" & Rows.Count).End(xlUp).Row
Columns("C:C").Select
Selection.Insert Shift:=xlToRight
Range("C4").FormulaR1C1 = _
"=IFERROR((INDEX(Detail!C[-2],MATCH(CMOP!RC[-1],Detail!C[-2],0))),""DELETE"")"
Range("C4").Select
Selection.Copy
Range("C4:C" & LstRw).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("C2").Select
Calculate
Dim lr As Long
lr = Cells(Rows.Count, "C").End(xlUp).Row
With Range("C4:C" & lr)
.AutoFilter
.AutoFilter Field:=1, Criteria1:="Delete"
.SpecialCells(xlCellTypeVisible).EntireRow.Delete
End With
Columns("C:C").Select
Selection.Delete Shift:=xlToLeft
Range("A4").Select
End If
End Sub