ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Help, cant figure out why it dosn't work. (https://www.excelbanter.com/excel-programming/350430-vba-help-cant-figure-out-why-dosnt-work.html)

Michael A

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!


Dave Peterson

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


All times are GMT +1. The time now is 06:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com