Results 1 to 6 of 6

VBA: using Evaluate with sumproduct function ( Date Comparison not working)

Threaded View

vidyuthrajesh VBA: using Evaluate with... 02-22-2012, 01:55 AM
mikerickson Re: VBA: using Evaluate with... 02-22-2012, 02:34 AM
vidyuthrajesh Re: VBA: using Evaluate with... 02-22-2012, 03:07 AM
OnErrorGoto0 Re: VBA: using Evaluate with... 02-22-2012, 04:15 AM
vidyuthrajesh Re: VBA: using Evaluate with... 02-22-2012, 04:30 AM
OnErrorGoto0 Re: VBA: using Evaluate with... 02-22-2012, 05:36 AM
  1. #1
    Forum Contributor
    Join Date
    02-22-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    102

    VBA: using Evaluate with sumproduct function ( Date Comparison not working)

    Hello,

    I am relatively new to this forum. Please accept my apologies if i had missed out on any forum rules. Now..

    1. i have a vba code which uses evaluate with Sumproduct function and it is (rather...was!) working
    2. i tried to expand this by including a date comparison but it is not working
    3. Date is stored in a cell which is in turn stored in a variable and i used that variable in the function
    4. Xmonth and Xweek (mentined below in code ) are names defined. we can assume Xdate also as same.
    5. Val1 / Val2 is declared as variant and it has values from cell and val3 stores date.

    Relevant extract from the code
    val1=range("i3").value
    val2=range("i4").value
    val3=range("i5").value

    myval=evaluate("=sumproduct((xmonth=""" & val1 &""")*(xweek=""" & val2 &""")

    but..if i append this with the following code it doesn't work...i tried multiple options like clng,datevalue etc..it give #name,#value and error message at times.

    myval=evaluate("=sumproduct((xmonth=""" & val1 &""")*(xweek=""" & val2 &""")*(xdate=""" & val3 &""")

    can someone help me out on this..and please revert for any additional information which is required which can help me in getting a resolution. Thx.
    Last edited by vidyuthrajesh; 02-27-2012 at 11:54 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1