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

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



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
Help writing a formula WA Excel Discussion (Misc queries) 3 May 28th 10 03:59 AM
Need help writing a formula phyllis Excel Worksheet Functions 13 June 4th 08 05:01 PM
Help in writing a formula Melody Excel Discussion (Misc queries) 1 February 21st 08 09:06 PM
Writing a Formula sadman49 Excel Discussion (Misc queries) 5 November 24th 06 08:03 PM
writing a formula changetires Excel Discussion (Misc queries) 1 June 27th 06 08:29 PM


All times are GMT +1. The time now is 03:38 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"