Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Writing Excel formulas in macros - Help!!

I am attempting to use a macro to write a formula in to a blank cell. When
the formula is written, the cell reference in the formula has apostrophes
around it so it won't function. I'm sure there is a syntax step I'm missing.
Can someone help??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Writing Excel formulas in macros - Help!!

hi
post your code

Regards
FSt1

"Mark Lucas" wrote:

I am attempting to use a macro to write a formula in to a blank cell. When
the formula is written, the cell reference in the formula has apostrophes
around it so it won't function. I'm sure there is a syntax step I'm missing.
Can someone help??

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Writing Excel formulas in macros - Help!!

I bet you're using .formulaR1C1, but you're creating the formula using A1
reference style.

Maybe you can use .formula (or actually change the formula so that it uses R1C1
reference style).

somecell.formulaR1C1 = "=...."
becomes
somecell.formula = "=...."


Mark Lucas wrote:

I am attempting to use a macro to write a formula in to a blank cell. When
the formula is written, the cell reference in the formula has apostrophes
around it so it won't function. I'm sure there is a syntax step I'm missing.
Can someone help??


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Writing Excel formulas in macros - Help!!

ActiveCell.FormulaR1C1 = "=IF(MID(b2,8,3)=""CFD"",1,0)" is the code in the
macro

=IF(MID('b2',8,3)="CFD",1,0) is what shows up in the cell.

"FSt1" wrote:

hi
post your code

Regards
FSt1

"Mark Lucas" wrote:

I am attempting to use a macro to write a formula in to a blank cell. When
the formula is written, the cell reference in the formula has apostrophes
around it so it won't function. I'm sure there is a syntax step I'm missing.
Can someone help??

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Writing Excel formulas in macros - Help!!

Hey that worked!!!! Thanks! So what is the difference between the styles?

"Dave Peterson" wrote:

I bet you're using .formulaR1C1, but you're creating the formula using A1
reference style.

Maybe you can use .formula (or actually change the formula so that it uses R1C1
reference style).

somecell.formulaR1C1 = "=...."
becomes
somecell.formula = "=...."


Mark Lucas wrote:

I am attempting to use a macro to write a formula in to a blank cell. When
the formula is written, the cell reference in the formula has apostrophes
around it so it won't function. I'm sure there is a syntax step I'm missing.
Can someone help??


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Writing Excel formulas in macros - Help!!

Wait there's more ... I want the cell reference to change as that formula is
being copied down the column. How can I write that in to the formula?


"FSt1" wrote:

hi
post your code

Regards
FSt1

"Mark Lucas" wrote:

I am attempting to use a macro to write a formula in to a blank cell. When
the formula is written, the cell reference in the formula has apostrophes
around it so it won't function. I'm sure there is a syntax step I'm missing.
Can someone help??

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Writing Excel formulas in macros - Help!!

Try toggle the setting and looking at a few formulas:

tools|options|General tab|check R1C1 reference style.

You'll notice that the columns are now numbered--not lettered.

And your formulas look like:

=if(r2c1="asdf","ok","not ok")
instead of
=if($A$2="asdf","ok","not ok")

Remember to toggle this setting back.

Mark Lucas wrote:

Hey that worked!!!! Thanks! So what is the difference between the styles?

"Dave Peterson" wrote:

I bet you're using .formulaR1C1, but you're creating the formula using A1
reference style.

Maybe you can use .formula (or actually change the formula so that it uses R1C1
reference style).

somecell.formulaR1C1 = "=...."
becomes
somecell.formula = "=...."


Mark Lucas wrote:

I am attempting to use a macro to write a formula in to a blank cell. When
the formula is written, the cell reference in the formula has apostrophes
around it so it won't function. I'm sure there is a syntax step I'm missing.
Can someone help??


--

Dave Peterson


--

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
writing excel macros TMiGNa Excel Programming 11 August 24th 06 05:44 PM
writing macros in excel sheet Richard Buttrey Excel Worksheet Functions 7 May 10th 06 01:04 AM
writing macros in excel jaffar Excel Programming 1 May 5th 06 02:06 PM
Writing Excel Macros in VB.NET/C# [email protected] Excel Programming 0 January 19th 06 04:02 AM
Writing Macros in Excel Shannon Excel Programming 6 August 13th 04 07:58 PM


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