PUT A FORMULA INTO A VARIABLE

gab

New Member
Joined
Jul 24, 2007
Messages
24
HI!!

I have the following formula

Activecell.FormulaR1C1 = "=CELL(""row"",INDEX(C[-2],MATCH(""INTEREST:"",C[-2],0)))"

And is working and allocating the result into a cell, but i want the result fo the formula into a variable for working in vba i.e X = "=CELL(""row"",INDEX(C[-2],MATCH(""LATE INTEREST & BK FEES :"",C[-2],0)))" and i just dont know how to do it

Thanks for any help!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Hello gab.
Both INDEX and MATCH can be exploited in vba using Application.WorksheetFunction; for example:
VAR1 = Application.WorksheetFunction.index(1,2)

Of course you can use Application.WorksheetFunction.match(arg, matr, 0) as an argument for Application.WorksheetFunction.index

Does this help? Bye.
 
Upvote 0
Thanks for your reply (because i needed that code for other stuff), but for in this case is different...let me explain more:

First I had a formula which put the resul into a cell. the initial code (and IT WORKS BUT I DONT WANT IN A CELL!) was:

Cells(3,13). Activate
ActiveCell.FormulaR1C1 = "=CELL(""row"",INDEX(C[-2],MATCH(""LATE INTEREST & BK FEES :"",C[-2],0)))"

a = Cells(3, 13)
But as you see...the result is allocating in a cell, not in a variable (AND I WANT INTO A VARIABLE!,,and dont know how!). I would like something like this:


a = CELL("row",INDEX(C[-2],MATCH(""LATE INTEREST & BK FEES :"",C[-2],0)))

so the variable "a" will be equal to the formula. And that's the issue!!! thanks for any help!
 
Upvote 0
besides anthonym sorry if you see this topic replicate as "allocate a formula into a variable" . i'm new in mr. excel, and instead of clicking on post reply, i did on new topic. sorry
 
Upvote 0

Forum statistics

Threads
1,214,563
Messages
6,120,248
Members
448,952
Latest member
kjurney

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top