Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6191803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:49:52+00:00 2026-05-24T02:49:52+00:00

I am new to VBA and want to add two values. The code I

  • 0

I am new to VBA and want to add two values. The code I have is:

Cells(7 + i + 1, 6).Select

sum1 = "=SUMIFS('[" + strFil_1 + "]Tooling forecast template'!R6C20:R500C20,'[" + strFil_1 + "]Tooling forecast template'!R6C7:R500C7,""=ME1"", '[" + strFil_1 + "]Tooling forecast template'!R6C5:R500C5,""=Test Tool"", '[" + strFil_1 + "]Tooling forecast template'!R6C13:R500C13,""=" + ArrME1(i) + """, '[" + strFil_1 + "]Tooling forecast template'!R6C6:R500C6,""<>Actual tool/equipment change"", '[" + strFil_1 + "]Tooling forecast template'!R6C23:R500C23,""<>Cancelled"", '[" + strFil_1 + "]Tooling forecast template'!R6C23:R500C23,""<>Not Ordered"")"

sum2 = "=SUMIFS('[" + strFil_1 + "]Tooling forecast template'!R6C20:R500C20,'[" + strFil_1 + "]Tooling forecast template'!R6C7:R500C7,""=ME1"", '[" + strFil_1 + "]Tooling forecast template'!R6C5:R500C5,""=Hard Tool"", '[" + strFil_1 + "]Tooling forecast template'!R6C13:R500C13,""=" + ArrME1(i) + """, '[" + strFil_1 + "]Tooling forecast template'!R6C6:R500C6,""<>Actual tool/equipment change"", '[" + strFil_1 + "]Tooling forecast template'!R6C23:R500C23,""<>Cancelled"", '[" + strFil_1 + "]Tooling forecast template'!R6C23:R500C23,""<>Not Ordered"") "

ActiveCell.FormulaR1C1 = sum1 + sum2

The reason I have the sum is because if I have it as one expression then the row will be too large and VBA doesn’t split it into two lines properly, if this is possible please post that as well.

The error I get with the above code is it just shows TRUE or FALSE and not the actually sum.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T02:49:53+00:00Added an answer on May 24, 2026 at 2:49 am

    If what you want is the sum of the results of the two formulae, then I’d suggest putting the actual formulae into two actual cells and adding the results. Call one the “Hard Tool” result and the other the “Test Tool” result, say.

    Alternatively, if you want to run the SUMIFS() function inside VBA then you may be able to do so with something like (for the first part, not tested)

    With Workbooks(strFil_1).Worksheets("Tooling forecast template")
        sum_range = Range(.Cells(6, 20), .Cells(500, 20))
        criteria_range1 = Range(.Cells(6, 7), .Cells(500, 7))
        criteria_range2 = Range(.Cells(6, 5), .Cells(500, 5))
        criteria_range3 = Range(.Cells(6, 13), .Cells(500, 13))
        criteria_range4 = Range(.Cells(6, 6), .Cells(500, 6))
        criteria_range5 = Range(.Cells(6, 23), .Cells(500, 23))
    End With
    
    sum1 = Application.WorksheetFunction.SumIfs( _
            sum_range, _
            criteria_range1, "ME1", _
            criteria_range2, "Test Tool", _
            criteria_range3, ArrME1(i), _
            criteria_range4, """<>Actual tool/equipment change""", _
            criteria_range5, """<>Cancelled""", _
            criteria_range5, """<>Not Ordered""" _
            )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to VBA. I have written this code inside a button click
I want to set value for cells by VBA. I have googled, and see
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
We have a lot of VBA code in spreadsheets and a lot of time
I have a worksheet with 2 columns Key and Value. by VBA code, i
I am fairly new to Excel VBA and have been trying to look for
We currently have an Excel spreadsheet containing a large amount of VBA code. The
I am new to VBA and want to return from a function when I
I want to dynamically add a radio button on a form, using VBA. I
I am trying to add some new constraints to my excel VBA solver solution

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.