Hi Good day cadunn and Dave I think this is because in VBA you cant use double quotes directly inside a text string.
Just use & Chr(34) & Instead of double quotes Hemant Hegde On Sep 24, 9:30 am, Dave Bonallack <davebonall...@hotmail.com> wrote: > Hi, > > Try this: > > Range("C" & CStr(LCurSRow)).Formula = "=COUNTIF(Dept!AR" & CStr(lRow) > & ":CE" & CStr(lRow) & ",>0)" > > Regards = Dave. > > > > > > > Date: Wed, 23 Sep 2009 17:12:13 -0700 > > Subject: $$Excel-Macros$$ Help with quotes in COUNTIF formula > > From: cad...@gmail.com > > To: excel-macros@googlegroups.com > > > Hi Everyone, > > > I'm have a problem with modifying the following excel formula into a > > macro. > > > This is the basic cell formula from excel > > It counts the number of cells in the range that are greater than 0. > > Excluding blank cells. > > > =COUNTIF(Dept!AR40:CE40,">0") > > > This is my attempt at writing the same formula above for a macro. > > Seems to be a problem with the quotes. Not sure what the problem is. > > Can someone help me? > > > THanks. > > Range("C" & CStr(LCurSRow)).Formula = "=COUNTIF("Dept!AR" & CStr(lRow) > > & ":CE" & CStr(lRow) & "," ">0")" > > _________________________________________________________________ > Get Hotmail on your iPhone Find out how > herehttp://windowslive.ninemsn.com.au/article.aspx?id=845706 --~--~---------~--~----~------------~-------~--~----~ ---------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,500 subscribers worldwide and receive many nice notes about the learning and support from the group. Our goal is to have 10,000 subscribers by the end of 2009. Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe -~----------~----~----~----~------~----~------~--~---