+ Reply to Thread
Results 1 to 2 of 2

VBA Help, cant figure out why it dosn't work.

  1. #1
    Michael A
    Guest

    VBA Help, cant figure out why it dosn't work.

    hello all, I was wondering If I could get a little help with this line, i
    cant figure out why it wont work. I use the same code on a different workbook
    with just the columns changed and it works fine..


    j = ActiveSheet.Evaluate("=SumProduct(--(A1:A3000=" & _
    CLng(CDate(nStuff)) & "),--(IsNumber(Find(""AH"",I1:I3000))))")

    however, in the same macro, these work correctly:

    i = Application.CountIf(.Columns(1), nStuff)
    k = Application.SumIf(.Columns(1), nStuff, .Columns(11))

    so I know that the nstuff value is correct.. any help would be greatly
    appreciated. Thanks!


  2. #2
    Dave Peterson
    Guest

    Re: VBA Help, cant figure out why it dosn't work.

    What does j equal when you run it? Or does the code blow up?

    If j = 0, then maybe you don't have upper AH in I1:I3000 of that activesheet.
    The worksheet function =Find() is case sensitive. You can use =Search() if you
    have AH, ah, Ah or aH to match.

    Or maybe A1:A3000 don't have real dates in them--or nstuff isn't really a date?



    Michael A wrote:
    >
    > hello all, I was wondering If I could get a little help with this line, i
    > cant figure out why it wont work. I use the same code on a different workbook
    > with just the columns changed and it works fine..
    >
    > j = ActiveSheet.Evaluate("=SumProduct(--(A1:A3000=" & _
    > CLng(CDate(nStuff)) & "),--(IsNumber(Find(""AH"",I1:I3000))))")
    >
    > however, in the same macro, these work correctly:
    >
    > i = Application.CountIf(.Columns(1), nStuff)
    > k = Application.SumIf(.Columns(1), nStuff, .Columns(11))
    >
    > so I know that the nstuff value is correct.. any help would be greatly
    > appreciated. Thanks!


    --

    Dave Peterson

+ Reply to Thread

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