Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Programming Excel worksheet function

Hello all!
I need extract all parameters from my function.
How I must do it?
For example I have function
function myfunc(byref a, b as double) as double
...
end function

sub fillcell
ActiveCell.FormulaR1C1 = "=myfunc(10,100)"
end sub

When I start sub "extract" I must extract (a and b parameter from function
of Activecell)
sub extract()
...
xA=a
xB=b
end sub
Thanks.
Stas.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Programming Excel worksheet function

Stas,

Try something like the following:

Sub Extract()
Dim Pos1 As Long
Dim Pos2 As Long
Dim S As String
Dim X1 As Variant
Dim X2 As Variant
S = ActiveCell.Formula
Pos1 = InStr(1, S, "(")
Pos2 = InStr(Pos1, S, ",")
X1 = Mid(S, Pos1 + 1, Pos2 - Pos1 - 1)
Pos1 = Pos2
Pos2 = InStr(Pos1, S, ")")
X2 = Mid(S, Pos1 + 1, Pos2 - Pos1 - 1)
Debug.Print X1, X2
End Sub

This will work only if the parameters to MyFunc are simple,
non-calculated values.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Stas" wrote in message
...
Hello all!
I need extract all parameters from my function.
How I must do it?
For example I have function
function myfunc(byref a, b as double) as double
...
end function

sub fillcell
ActiveCell.FormulaR1C1 = "=myfunc(10,100)"
end sub

When I start sub "extract" I must extract (a and b parameter

from function
of Activecell)
sub extract()
...
xA=a
xB=b
end sub
Thanks.
Stas.




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
Worksheet set-up/programming Cathy Excel Worksheet Functions 0 July 30th 09 01:36 PM
Posted in excel.public.programming ... Count only theformula/function find the same value ... ytayta555 Excel Worksheet Functions 2 April 27th 09 11:11 PM
WORKSHEET FUNCTION or PROGRAMMING. rml Excel Worksheet Functions 8 November 11th 06 08:55 PM
Function/Programming help with excel Excel_Newbie09 Excel Discussion (Misc queries) 7 April 3rd 06 02:38 PM
Programming function keys in Excel Box815 Excel Discussion (Misc queries) 2 March 22nd 06 05:57 PM


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