Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default How to use Sumproduct in VBA???

Hi friends,

I wanna know what's the problem with:

Public Function FHWA(One, Two)
FHWA=Application.Caller.Parent.Evaluate( _
"SUMPRODUCT("&One.Address&","&Two.Address&")")
End Function

The code gives a:
Compile Error
Expected: list separator or )

What would be the appropriate way to write a simple code for sumproduct of
two arrays named One & Two?

Thanx
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 76
Default How to use Sumproduct in VBA???

Hi

Make sure you separate your concatenation operator (&) from the
variable names - the following works for me:

Public Function FHWA(One, Two)
FHWA = Application.Caller.Parent.Evaluate( _
"SUMPRODUCT(" & One.Address & "," & Two.Address & ")")
End Function

Hope this helps!

Richard

On 31 Dec, 09:36, FARAZ QURESHI
wrote:
Hi friends,

I wanna know what's the problem with:

Public Function FHWA(One, Two)
FHWA=Application.Caller.Parent.Evaluate( _
* * "SUMPRODUCT("&One.Address&","&Two.Address&")")
End Function

The code gives a:
Compile Error
Expected: list separator or )

What would be the appropriate way to write a simple code for sumproduct of
two arrays named One & Two?

Thanx


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default How to use Sumproduct in VBA???

You might want some error handling

Public Function FHWA(One, Two)
If One.Cells.Count < Two.Cells.Count Then
FHWA = "# mismatched ranges"
Else
FHWA = Application.Caller.Parent.Evaluate( _
"SUMPRODUCT(" & One.Address & "," & Two.Address & ")")
End If
End Function




--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"RichardSchollar" wrote in message
...
Hi

Make sure you separate your concatenation operator (&) from the
variable names - the following works for me:

Public Function FHWA(One, Two)
FHWA = Application.Caller.Parent.Evaluate( _
"SUMPRODUCT(" & One.Address & "," & Two.Address & ")")
End Function

Hope this helps!

Richard

On 31 Dec, 09:36, FARAZ QURESHI
wrote:
Hi friends,

I wanna know what's the problem with:

Public Function FHWA(One, Two)
FHWA=Application.Caller.Parent.Evaluate( _
"SUMPRODUCT("&One.Address&","&Two.Address&")")
End Function

The code gives a:
Compile Error
Expected: list separator or )

What would be the appropriate way to write a simple code for sumproduct of
two arrays named One & Two?

Thanx



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default How to use Sumproduct in VBA???

Thanx Richard,

It was your example that clarified to me now that there should be a space
existing between the concatenating symbol and rest.

In other words:

"SUMPRODUCT(" & One.Address & "," & Two.Address & ")") IS CORRECT
"SUMPRODUCT("&One.Address&","&Two.Address&")") IS WRONG

Thanx again!

"RichardSchollar" wrote:

Hi

Make sure you separate your concatenation operator (&) from the
variable names - the following works for me:

Public Function FHWA(One, Two)
FHWA = Application.Caller.Parent.Evaluate( _
"SUMPRODUCT(" & One.Address & "," & Two.Address & ")")
End Function

Hope this helps!

Richard

On 31 Dec, 09:36, FARAZ QURESHI
wrote:
Hi friends,

I wanna know what's the problem with:

Public Function FHWA(One, Two)
FHWA=Application.Caller.Parent.Evaluate( _
"SUMPRODUCT("&One.Address&","&Two.Address&")")
End Function

The code gives a:
Compile Error
Expected: list separator or )

What would be the appropriate way to write a simple code for sumproduct of
two arrays named One & Two?

Thanx



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? sumif(sumproduct)? David Excel Worksheet Functions 3 July 13th 07 07:06 PM
SUMPRODUCT Sho Excel Worksheet Functions 5 November 11th 05 10:47 AM
SUMPRODUCT Jim Excel Worksheet Functions 1 November 11th 05 04:58 AM
Using SumProduct in VB Michael Excel Discussion (Misc queries) 4 November 10th 05 06:16 PM
Sumproduct? cjjoo Excel Worksheet Functions 9 October 11th 05 12:31 PM


All times are GMT +1. The time now is 11:37 PM.

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

About Us

"It's about Microsoft Excel"