ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help needed to write a "SUMIF" formula in VBA (https://www.excelbanter.com/excel-programming/319637-help-needed-write-sumif-formula-vba.html)

JIMBROOKS

Help needed to write a "SUMIF" formula in VBA
 
I am using Excel 2000 and I have a question regarding a "sumif" formula. I
use a wookbook to calculate petty cash purchases daily with a table with all
the calculations on sheet1. I wish to change the calculations to VBA to stop
any corruption of sheet1 which I have done apart from the formula
+sumif(E9:E16,"TH",B9:B16) the "TH" being an employee's initials. I would
like to change "TH" to a cell reference that being sheet2.range("B2") if
that is possible so that the formula would be equivalent to
+sumif(E9:E16,"SHEET2.RANGE("B2")",B9:B16) in VBA
many thanks in advance
regards JIM BROOKS



Jerry W. Lewis

Help needed to write a "SUMIF" formula in VBA
 
WorksheetFunction.SumIf(Worksheets("Sheet2").[E9:E16],
Worksheets("Sheet2").[B2], Worksheets("Sheet2").[B9:B16])

Jerry

JIMBROOKS wrote:

I am using Excel 2000 and I have a question regarding a "sumif" formula. I
use a wookbook to calculate petty cash purchases daily with a table with all
the calculations on sheet1. I wish to change the calculations to VBA to stop
any corruption of sheet1 which I have done apart from the formula
+sumif(E9:E16,"TH",B9:B16) the "TH" being an employee's initials. I would
like to change "TH" to a cell reference that being sheet2.range("B2") if
that is possible so that the formula would be equivalent to
+sumif(E9:E16,"SHEET2.RANGE("B2")",B9:B16) in VBA
many thanks in advance
regards JIM BROOKS




All times are GMT +1. The time now is 09:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com