change the formula................... ActiveCell.Formula = "=SUMIFS(D3:D20,$C$3:$C$20,"">""&EOMONTH(MAX(D3:D20),-1))"
sees on the right hand side of the = sign the two string literals "SUMIFS(D$3:D$200,$C$3:$C$20," and "&EOMONTH(MAX($D$3:$D$20),-1))" with the > comparison operator between them. So it compares the two strings and finds that "S" comes after "&" and the result of the comparison is the boolean value TRUE. So it assigns that to the FormulaR1C1 property of the cell - but that is a text property so VBA converts the boolean TRUE to the string "TRUE" and that's what you see in your worksheet. On Wed, Aug 3, 2011 at 7:25 PM, KAUSHIK SAVLA <savla.kaus...@gmail.com> wrote: > Hi All, > I am trying to run the below macro code in the attached file. > Code is running properly since i am not getting any error message. > But i am getting in Row D2 to H2 "TRUE" and not the calculation value. > Option Explicit > Sub SumifsFormula() > ' > ' SumifsFormula Macro > ' Sumifs Formula for calculating current month total > ' > ' > Range("D2").Select > ActiveCell.FormulaR1C1 = _ > "SUMIFS(D$3:D$200,$C$3:$C$20," > "&EOMONTH(MAX($D$3:$D$20),-1))" > Range("D2").Select > Selection.Copy > Range("D2:H2").Select > ActiveSheet.Paste > Application.CutCopyMode = False > Calculate > > End Sub > Please help on this macros. > Regards, > kaushik savla > > -- > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/discussexcel > -- ......................... -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel