Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

How to write a formula with a user defined function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
reteid2222 - 23 Jan 2006 17:55 GMT
Tried to write something like this:
[image: http://img461.imageshack.us/img461/7426/excel2co.jpg]

Here s the code:

Sub WriteFunctionTerm(TargetAdress, Order, xValueAdress, yValueAdress)
Dim OrderStr$

xValue = Range(xValueAdress).Cells
yValue = Range(yValueAdress).Cells
If Order = 0 Then
Range(TargetAdress).Cells = "f(" & xValue & ")=" & yValue
Else
OrderStr$ = String(Order, "I")
Range(TargetAdress).Cells = _
"f(" & OrderStr$ & ")(" & xValue & ")=" & yValue
Range(TargetAdress).Characters _
(Start:=2, Length:=2 + Len(OrderStr$)).Font.Superscript =
True
End If
End Sub

This works fine in a sub under a command button, but how to code it in
a function? The content of the cell will only refresh when I leave the
function....and how can I get the information from where the function
is called?
Thanx for helping!

Signature

reteid2222

Bob Phillips - 23 Jan 2006 18:24 GMT
Worksheet functions cannot set the attributes of the sheet, just return a
value, so it cannot set superscripts. You should do it as a worksheet change
event. See http://www.cpearson.com/excel/events.htm for details

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

> Tried to write something like this:
> [image: http://img461.imageshack.us/img461/7426/excel2co.jpg]
[quoted text clipped - 29 lines]
> reteid2222's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=30745
> View this thread: http://www.excelforum.com/showthread.php?threadid=504114
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.