Populate stats from attached XL file into body of email

Important Notice

Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • 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:

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


    Edited once, last by 2Took ().

  • Solved:

    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!