Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Writing a formula into a cell

How should the code look like if I want my macro to enter a formula into a cell.

Example
Cell A1 is empt
I run my macro
Cell A1 contains the formula: =IF(B1="";"Ok";""

Any help is appriciated, thank you
Schwart

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Writing a formula into a cell

Schwartz.

Try this

Range("A1").FormulaR1C1="=IF(RC[1],"""",""Ok"")"

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Dr. Schwartz" wrote in message
...
How should the code look like if I want my macro to enter a formula into a

cell.

Example:
Cell A1 is empty
I run my macro
Cell A1 contains the formula: =IF(B1="";"Ok";"")

Any help is appriciated, thank you.
Schwartz



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Writing a formula into a cell

If you don't want to use R1C1 syntax, try this :

Range("A1").FormulaLocal="=IF(" & Cells(1,2).Address & " ,"""",""Ok"")

--
Message posted from http://www.ExcelForum.com

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 Ms-Exl-Learner Excel Discussion (Misc queries) 2 May 27th 10 09:45 PM
writing an IF/AND formula Jill_ Excel Worksheet Functions 1 October 15th 09 06:29 PM
Need help writing a formula phyllis Excel Worksheet Functions 13 June 4th 08 05:01 PM
Writing a formula changetires Excel Discussion (Misc queries) 1 June 27th 06 05:18 PM
Need Help Writing a Formula Lynn Excel Worksheet Functions 11 September 11th 05 07:51 PM


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