Formula Not Working-Help Please!!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can someone tell me what is wrong with this code? I get an
application/object defined error on the 2nd row. Am trying to insert a sumif
formula into a cell, to add only those cells that do NOT have the word "MES"
in them.

Cells(Cells.Rows.Count, "T").End(xlUp).Offset(-1, 0).Select
Selection.Formula = "=SUMIF(I12:I50030,<> ""MES"",T12:T50030)"

Thanks.....
 
Selection.Formula = "=SUMIF(I12:I50030,""<>MES"",T12:T50030)"

HTH
 
You need more quotes around the criterion parameter:

Selection.Formula = "=SUMIF(I12:I50030,""<>
""""MES"""""",T12:T50030)"
 
Thanks guys!

Andrew Taylor said:
You need more quotes around the criterion parameter:

Selection.Formula = "=SUMIF(I12:I50030,""<>
""""MES"""""",T12:T50030)"
 
Why does this code not work?

Workbooks("TEST").Sheets(1).Cells(10, 11).Formula ="=IF(H" & 10 & "=" &
"""XYZ""" & ";" & "G" & 10 & ";" & "0)"


thx in adv.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top