View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Why does this COUNTIF code not work

Quote marks that are internal to a string constant must be doubled up so
that VB knows where the string constant begins and ends. Try it this way...

Range("L2").Formula = "=COUNTIF(E2:E25,""Missed code date"")"

--
Rick (MVP - Excel)


"ChipButtyMan" wrote in message
...
Hi,
I get an Expected; end of statement error with this code. The
word 'Missed' is highlighted as the point of the error.



Private Sub CommandButton8_Click()

Range ("L2").Formula = "=COUNTIF(E2:E25,"Missed code date")"

End Sub