ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Accessing Excel Formula (https://www.excelbanter.com/excel-programming/348606-accessing-excel-formula.html)

incjourn[_6_]

Accessing Excel Formula
 

All,

If I have an excel formula in a worksheet (such has vlookup(x,y,z).
I can get the formula using *F = cells(i,j).formula *

Is there and easy way to get x,y,z from F?

Regards

Phil:confused

--
incjour

-----------------------------------------------------------------------
incjourn's Profile: http://www.excelforum.com/member.php...nfo&userid=721
View this thread: http://www.excelforum.com/showthread.php?threadid=49513


Tom Ogilvy

Accessing Excel Formula
 
If they were all ranges, you could look at DirectPrecedents

but to parse out the arguments:

Sub GetArgs()
Range("A1").Formula = "=Vlookup(""Dog"",Sheet2!A1:C200,3,False)"
sstr = Range("A1").Formula
sstr = Replace(sstr, "(", ",")
sstr = Replace(sstr, ")", "")
v = Split(sstr, ",")
For i = LBound(v) To UBound(v)
Debug.Print i, v(i)
Next
End Sub


Produces
0 =VLOOKUP
1 "Dog"
2 Sheet2!A1:C200
3 3
4 FALSE

--
Regards,
Tom Ogilvy


"incjourn" wrote in
message ...

All,

If I have an excel formula in a worksheet (such has vlookup(x,y,z).
I can get the formula using *F = cells(i,j).formula *

Is there and easy way to get x,y,z from F?

Regards

Phil:confused:


--
incjourn


------------------------------------------------------------------------
incjourn's Profile:

http://www.excelforum.com/member.php...fo&userid=7213
View this thread: http://www.excelforum.com/showthread...hreadid=495138





All times are GMT +1. The time now is 12:07 AM.

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