user27629525
user27629525

Reputation: 1

Excel VBA code for application Evaluate not working

i am getting below error when excuting the application.evaluate. please help me to fix this case.

enter image description here

Sub updatespare()
    Dim c As Long
    Sheets("Summary_Updated").Select
    lrow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
    lcol = ActiveSheet.Cells(1, ActiveSheet.Columns.Count).End(xlToLeft).Column
    For r = 2 To lrow
        For c = 5 To lrow
            colA = ConvertToLetter(c)
            **Cells(r, c).Value = Application.Evaluate("=IFERROR(ROWS(FILTER(Spares!$A:$K,((Spares!$C:$C=Summary_Updated!$A" & r & ")*(Spares!$G:$G=Summary_Updated!" & colA & "$1)))),"""")")**
        Next
    Next
End Sub
Function ConvertToLetter(iCol As Long) As String
   Dim a As Long
   Dim b As Long
   a = iCol
   ConvertToLetter = ""
   Do While iCol > 0
      a = Int((iCol - 1) / 26)
      b = (iCol - 1) Mod 26
      ConvertToLetter = Chr(b + 65) & ConvertToLetter
      iCol = a
   Loop
End Function

        Cells(r, c).Value = Application.Evaluate("=IFERROR(ROWS(FILTER(Spares!$A:$K,((Spares!$C:$C=Summary_Updated!$A1)*(Spares!$G:$G=Summary_Updated!E$1)))),"""")")**

i tried this but no luck.

Upvotes: 0

Views: 61

Answers (0)

Related Questions