Thread: dynamic formula
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default dynamic formula


Dim LastRecordNew2 As Long
LastRecordNew2 = 33
With ActiveSheet
.Range("AJ8:AJ" & LastRecordNew2).Formula _
= "=IF(ISERROR(BB8/BC8),""No Data"",BB8/BC8)"
End With

You have to use " for strings (not apostrophes) in your formulas. And in VBA,
you have to double them up to get one.

geebee wrote:

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


--

Dave Peterson