Hi all,
I am a VBA novice trying to get the syntax correct for auto-populating a form that I have where I need an OR condition, or something similar. In a regular workbook, this would be a matter of creating an array formula or adding two sumifs together.
I'm not as sure how that works in the VBA macro world and cannot seem to find specific examples of anyone doing anything similar.
Here is my current coding:
I found out that the company changed coding a few years ago, so there was a time when the ABCD coding in my spreadsheets in column Y simultaneously existed along with WXYZ coding for the same program.
I want to create something where by coding can sumifs on Y3:Y10000 if it equals either ABCD or WXYZ and ignore the rest of the codes. I have tried it a few different ways without getting the syntax correct, but the code works fine when I do not try to add an OR condition anywhere. Maybe I just need another long line of code and add the sumifs for WXYZ and ABCD togehter?
I am a VBA novice trying to get the syntax correct for auto-populating a form that I have where I need an OR condition, or something similar. In a regular workbook, this would be a matter of creating an array formula or adding two sumifs together.
I'm not as sure how that works in the VBA macro world and cannot seem to find specific examples of anyone doing anything similar.
Here is my current coding:
Code:
notsrc.Worksheets("Name_of_Worksheet").Range("D57").Value = WorksheetFunction.SumIfs(src.Worksheets("sheet1").Range("A3:A10000"), src.Worksheets("sheet1").Range("A3:A10000"), "=1", src.Worksheets("sheet1").Range("Y3:Y10000"), "=ABCD")
I found out that the company changed coding a few years ago, so there was a time when the ABCD coding in my spreadsheets in column Y simultaneously existed along with WXYZ coding for the same program.
I want to create something where by coding can sumifs on Y3:Y10000 if it equals either ABCD or WXYZ and ignore the rest of the codes. I have tried it a few different ways without getting the syntax correct, but the code works fine when I do not try to add an OR condition anywhere. Maybe I just need another long line of code and add the sumifs for WXYZ and ABCD togehter?
Last edited: