Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 231
Default Can I insert formulas into my macros?

I tried recording some formulas into a macro, but this doesn't work. Is it
possible to do so, without using Visual Basic programming? Can it be done
using Visual Basic programming - I am not an expert :-)
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Can I insert formulas into my macros?

Sarah,

You can record formula entry with the macro recorder:-
ActiveCell.Formula = "=SUM(A3:A9)"
ActiveCell.FormulaR1C1 = "=SUM(RC[-1]:R[6]C[-1])"

These 2 formula are the same, they are in B3 and add up A3 to A9. The first
is entered manually and the second is the recorded version of the same thing.

What precisely are you trying to do?


Mike


"Sarah" wrote:

I tried recording some formulas into a macro, but this doesn't work. Is it
possible to do so, without using Visual Basic programming? Can it be done
using Visual Basic programming - I am not an expert :-)

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 231
Default Can I insert formulas into my macros?

Hi Mike,

Thanks for your quick answer ! In fact, I tried recording the copying a
formula I created earlier in another workbook (this one below)

=IF(ISERROR(LEFT(F2;FIND(200;F2)-1));F2;(LEFT(F2;FIND(200;F2)-1)))
it replaces a word, with a number after the word starting by 200, by only
the word

because I always have to do this when I create the updated version of the
same report.

Are you saying that it is necessary to insert the formula manually for it to
be recorded by a macro, and that I can not copy the formula from another
worksheet?

Sarah

"Mike H" wrote:

Sarah,

You can record formula entry with the macro recorder:-
ActiveCell.Formula = "=SUM(A3:A9)"
ActiveCell.FormulaR1C1 = "=SUM(RC[-1]:R[6]C[-1])"

These 2 formula are the same, they are in B3 and add up A3 to A9. The first
is entered manually and the second is the recorded version of the same thing.

What precisely are you trying to do?


Mike


"Sarah" wrote:

I tried recording some formulas into a macro, but this doesn't work. Is it
possible to do so, without using Visual Basic programming? Can it be done
using Visual Basic programming - I am not an expert :-)

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Can I insert formulas into my macros?

Sarah,

I can see what you formula does but I'm not sure what the question is, take
these 2 examples

Range("F3").Formula =
"=IF(ISERROR(LEFT(F2,FIND(200,F2)-1)),F2,(LEFT(F2,FIND(200,F2)-1)))"

Range("F3").Formula = Sheets("Sheet1").Range("F5").Formula

The first puts you formula into F3 and the second copies your fromula from
F5 to F3
Note i've changed ; to , for my version of Excel

Mike

"Sarah" wrote:

Hi Mike,

Thanks for your quick answer ! In fact, I tried recording the copying a
formula I created earlier in another workbook (this one below)

=IF(ISERROR(LEFT(F2;FIND(200;F2)-1));F2;(LEFT(F2;FIND(200;F2)-1)))
it replaces a word, with a number after the word starting by 200, by only
the word

because I always have to do this when I create the updated version of the
same report.

Are you saying that it is necessary to insert the formula manually for it to
be recorded by a macro, and that I can not copy the formula from another
worksheet?

Sarah

"Mike H" wrote:

Sarah,

You can record formula entry with the macro recorder:-
ActiveCell.Formula = "=SUM(A3:A9)"
ActiveCell.FormulaR1C1 = "=SUM(RC[-1]:R[6]C[-1])"

These 2 formula are the same, they are in B3 and add up A3 to A9. The first
is entered manually and the second is the recorded version of the same thing.

What precisely are you trying to do?


Mike


"Sarah" wrote:

I tried recording some formulas into a macro, but this doesn't work. Is it
possible to do so, without using Visual Basic programming? Can it be done
using Visual Basic programming - I am not an expert :-)

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
macros to insert specific rows without altering the formula Mysore Excel Discussion (Misc queries) 4 September 4th 07 05:04 PM
using formulas in macros BBEXCELNOVICE Excel Discussion (Misc queries) 4 November 12th 06 10:03 AM
Trouble using macros to insert rows [email protected] Excel Discussion (Misc queries) 6 November 1st 06 04:52 PM
formulas vs macros excelFan Excel Discussion (Misc queries) 4 March 23rd 06 01:45 PM
Macros/Formulas Michelle Excel Worksheet Functions 2 October 26th 05 04:26 PM


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