Thread: dynamic formula
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1688_] Rick Rothstein \(MVP - VB\)[_1688_] is offline
external usenet poster
 
Posts: 1
Default dynamic formula

Apostrophes do not delimit text in Excel; quote marks do. However, quote
marks inside of a String constant must be doubled up in order for VB to
treat them as real quote marks and not text String delimiters. Try it this
way...

Range("AJ8:AJ" & lastrecordNew2).Formula = _
"=IF(ISERROR(BB8/BC8),""No Data"",BB8/BC8)"

Also notice that there is no reason to select the cell in order to address
one of its properties.

Rick


"geebee" (noSPAMs) wrote in message
...
hi,

i have the following:

Range("AJ8:AJ" & lastrecordNew2).Select
Selection.Formula = "=IF(ISERROR(BB8/BC8),'No Data',BB8/BC8)"

but i have a problem with this because its not working right. i think it
has something to do with the syntax or something around the No Data.

how can i fix this?

thanks in advance,
geebee