Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 837
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to write formula for countif (range,"<2" &"3") Vinod Tripathi Excel Discussion (Misc queries) 1 May 1st 09 07:27 AM
How do I write an excel formula with a text answer ("yes" or "no") pat Excel Discussion (Misc queries) 1 September 9th 08 03:41 PM
Sumif formula that uses "contains" rather than "equals" jerrymcm Excel Discussion (Misc queries) 4 October 2nd 07 05:15 PM
help needed on "sumif function with multiple ifs" sangee Excel Discussion (Misc queries) 2 December 16th 05 03:41 PM
Using "Cells" to write "Range("A:A,H:H").Select" Trip Ives[_2_] Excel Programming 3 June 5th 04 03:13 PM


All times are GMT +1. The time now is 05:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"