ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   macro recorder and formulas (https://www.excelbanter.com/excel-discussion-misc-queries/135416-macro-recorder-formulas.html)

Dave F

macro recorder and formulas
 
I just recorded a macro for which one of the steps is a rather complicated
ISNUMBER/MATCH function:

ActiveCell.FormulaR1C1 = _
"=IF(AND(ISNUMBER(MATCH(LEFT(RC[-18],3),'[ELR expense account
identification.xls]Sheet1'!R2C1:R12C1,0)),ISNUMBER(MATCH(RC[-17],'[Frank''s
expense codes--GDCS and
non-GDCS.xls]Sheet1'!R2C1:R39C1,0))),""Extract"","""")"

Two questions:
1) How do I get the macro to always insert this formula into cell T2?
2) Why does the macro recorder record in R1C1 format? Is it possible to get
it to record in regular A1 format?

Thanks,

Dave

Pete_UK

macro recorder and formulas
 
Dave,

1. This is going to put the formula in the activecell, so to make
sure the activecell is T2 have a line before it:

Range("T2").Select

2. The macro recorder always seems to use R1C1 format - I don't know
if there is a setting to change this, but you can always edit the
formula after recording the macro.

Hope this helps.

Pete


On Mar 19, 2:27 pm, Dave F wrote:
I just recorded a macro for which one of the steps is a rather complicated
ISNUMBER/MATCH function:

ActiveCell.FormulaR1C1 = _
"=IF(AND(ISNUMBER(MATCH(LEFT(RC[-18],3),'[ELR expense account
identification.xls]Sheet1'!R2C1:R12C1,0)),ISNUMBER(MATCH(RC[-17],'[Frank''s
expense codes--GDCS and
non-GDCS.xls]Sheet1'!R2C1:R39C1,0))),""Extract"","""")"

Two questions:
1) How do I get the macro to always insert this formula into cell T2?
2) Why does the macro recorder record in R1C1 format? Is it possible to get
it to record in regular A1 format?

Thanks,

Dave




Dave F

macro recorder and formulas
 
Thanks, just figured 1 out, and as for number 2 I suppose it doesn't matter
as long as I know the formula works in A1 format.

Dave
--
A hint to posters: Specific, detailed questions are more likely to be
answered than questions that provide no detail about your problem.


"Pete_UK" wrote:

Dave,

1. This is going to put the formula in the activecell, so to make
sure the activecell is T2 have a line before it:

Range("T2").Select

2. The macro recorder always seems to use R1C1 format - I don't know
if there is a setting to change this, but you can always edit the
formula after recording the macro.

Hope this helps.

Pete


On Mar 19, 2:27 pm, Dave F wrote:
I just recorded a macro for which one of the steps is a rather complicated
ISNUMBER/MATCH function:

ActiveCell.FormulaR1C1 = _
"=IF(AND(ISNUMBER(MATCH(LEFT(RC[-18],3),'[ELR expense account
identification.xls]Sheet1'!R2C1:R12C1,0)),ISNUMBER(MATCH(RC[-17],'[Frank''s
expense codes--GDCS and
non-GDCS.xls]Sheet1'!R2C1:R39C1,0))),""Extract"","""")"

Two questions:
1) How do I get the macro to always insert this formula into cell T2?
2) Why does the macro recorder record in R1C1 format? Is it possible to get
it to record in regular A1 format?

Thanks,

Dave






All times are GMT +1. The time now is 11:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com