Results 1 to 6 of 6

Thread: sumifs in VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Looks like I got it figured out!

    First off, the syntax of sumifs is the same in VBA as in the worksheet formula. That was my biggest problem, although using the set statement is necessary if you're going to define the ranges in the formula using variables. Entire columns worked ok as well using XL2007

    Here is the result:
    Dim eng_hours As Double
    Dim maj_group As Range, bill_summary As Range, mtd_ttl_hours As Range
    Set maj_group = Range("C:C")
    Set bill_summary = Range("D:D")
    Set mtd_ttl_hours = Range("E:E")
    eng_hours = Application.WorksheetFunction.SumIfs(mtd_ttl_hours, maj_group, "ENG", bill_summary, "LABOR")
    thanks a ton for you help .45!

    edit - you're right Paul. I don't really know why I ever thought it would be different from the syntax used in the worksheet
    Last edited by Aussiebear; 05-04-2025 at 11:13 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •