View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default help writing formula

To include a " character in a VBA string, use two " characters.
E.g.,

ActiveCell.Formula = "=IF(OR(B" & ActiveCell.Row & "=6,B" & _
ActiveCell.Row & "=7),""""," & strHoldFormula & ")"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Ryan Proudfit" wrote in
message
...
The current formula residing in about 200 cells is

='Daily N '!AN13

I'm trying to write a macro that will change that formula to

=IF(OR(B9=6,B9=7),"",'Daily N '!AN13)

Here is my code

ActiveCell.Formula = "=IF(OR(B" & ActiveCell.Row & "=6,B" &
ActiveCell.Row &
"=7),""," & strHoldFormula & ")"

My problem is

"=7),"","

Since quotes are used to identify the beginning and end of a
text string
within a formula, how do you use quotes within a formula to
tell Excel to
display nothing if a condition is true?

--
Ryan Proudfit