Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default sumproduct or sumif in vba

I'm taking a long shot here but my question is
can sumproduct or sumif be used in VBA with a User filling in the blanks
with selections or text he/she has entered?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default sumproduct or sumif in vba

Hi

If you mean you want to use the SumIf function in VBA then yes you can. One
way is with the Evaluate function which will also allow you to build the
string from variables your user can set. Example would be:

strCriteriaRange = "Sheet1!A1:A10"
strCriteriaValue = "a"
strSumRange = "Sheet1!B1:B10"


MsgBox Evaluate("sumif(" & strCriteriaRange & ",""" & strCriteriaValue &
"""," & strSumRange & ")")

This will return the same value as if you put
=SumIf(Sheet1!A1:A10,"a",Sheet1!B1:B10) into a cell in the spreadsheet.

HTH

Barry


"hellZg8" wrote:

I'm taking a long shot here but my question is
can sumproduct or sumif be used in VBA with a User filling in the blanks
with selections or text he/she has entered?

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
sumproduct or sumif I need help, Thank you Eduardo Excel Discussion (Misc queries) 4 September 26th 08 02:12 PM
SumIf or SumProduct Blddrgn700 Excel Discussion (Misc queries) 2 June 27th 08 08:10 AM
HELP !!! SUMIF or SUMPRODUCT Soultek Excel Discussion (Misc queries) 3 March 21st 07 03:30 PM
Sumif or Sumproduct Steve Excel Worksheet Functions 1 February 4th 06 08:43 PM
SUMIF or SUMPRODUCT or something else? || cypher || Excel Worksheet Functions 7 November 9th 04 10:45 PM


All times are GMT +1. The time now is 02:31 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"