0

Could you please advise how to convert a formula to VBA code

=SUMPRODUCT(SUBTOTAL(3,OFFSET((AT2:AT644),ROW(AT2:AT644)-MIN(ROW(AT2:AT644)), ,1)) * (AT2:AT644="6"))

i do like this, but question how to use "offset" in current code?

Application.WorksheetFunction.SumProduct(Application.WorksheetFunction.Subtotal(3, Application.Range.Offset(("AT2:AT644"), Application.Rows("AT2:AT644") - Application.WorksheetFunction.Min(Application.Rows("AT2:AT644")), , 1)) * ("AT2:AT644" = "6"))

Thanks,
Regards,
Lure

0

1 Answer 1

1

Migrated from comment...

Debug.Print Sheet1.Evaluate("SUMPRODUCT(SUBTOTAL(3,OFFSET((AT2:AT644),ROW(AT2:AT644)-MIN(ROW‌​(AT2:AT644)), ,1)) * (AT2:AT644=""6""))") 

or whichever sheet you need to use, just don't use Application.Evaluate unless you want it to always evaluate in the context of the ActiveSheet.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.