Populate stats from attached XL file into body of email

  • I have a code that attaches active Excel workbook to an email, populates, to: cc: subject: and body. In body text have a placeholder: ZZZZZ Need for it to be replaced with number of rows in column A that have value over 10


    Getting a Compile error: Syntax error on second line of the following bit of code:


    Code
    Dim Y As Integer
    
    Y = WorksheetFunction.CountIf(Range("a2").End(xlDown).Value, >10)
    
    EmailItem.HTMLBody = Replace(EmailItem.HTMLBody, "ZZZZZ", Y)



    Help!

    Edited once, last by 2Took ().

  • Solved:


    Code
    Y = Application.WorksheetFunction.CountIf(Range("A:A"), ">10")

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!