Godders199
Active Member
- Joined
- Mar 2, 2017
- Messages
- 313
- Office Version
- 2013
Hello, I am trying to change the following to vba, but keep getting a mismatch error I cannot work out which part of the VBA has the error. I presume it is this part “Worksheets("ch"), Range("M:M"), Cells(b, 1)” .. Column 1 is a list of names.
Any help would be appreciated.
=SUMIFS(Ch!Z:Z,Ch!M:M,"*"&A3&"*",Ch!X:X,"2")
My code
Sheets("RM").Select
Dim lastrowcolumnb As Long
lastrowcolumnb = Range("a" & Rows.Count).End(xlUp).Row
For b = 3 To lastrowcolumnb
Cells(b, 3) = WorksheetFunction.SumIfs(Worksheets("ch").Range("Z:Z"), Worksheets("ch"), Range("M:M"), Cells(b, 1), Worksheets("Ch").Range("X:X"), "2")
Any help would be appreciated.
=SUMIFS(Ch!Z:Z,Ch!M:M,"*"&A3&"*",Ch!X:X,"2")
My code
Sheets("RM").Select
Dim lastrowcolumnb As Long
lastrowcolumnb = Range("a" & Rows.Count).End(xlUp).Row
For b = 3 To lastrowcolumnb
Cells(b, 3) = WorksheetFunction.SumIfs(Worksheets("ch").Range("Z:Z"), Worksheets("ch"), Range("M:M"), Cells(b, 1), Worksheets("Ch").Range("X:X"), "2")