Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default dynamic formula

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to convert a static formula to dynamic formula ? Pisistratus Excel Worksheet Functions 3 July 5th 07 01:54 PM
Dynamic Formula with Dynamic Address dmz_asdf Excel Worksheet Functions 7 December 15th 06 07:13 PM
Help with copying dynamic column selected based on remote cell value and dynamic formula fill ers Charts and Charting in Excel 0 March 1st 06 01:05 AM
Help with copying dynamic column selected based on remote cell value and dynamic formula fill ers Excel Programming 0 March 1st 06 01:05 AM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM


All times are GMT +1. The time now is 06:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"