View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Arvi Laanemets
 
Posts: n/a
Default 1 TO 9 EXCEPT CELL CONTENT

With workbook open:
press Alt+F11
InsertModule (when you don't have one)
InsertProcedure, type in the function name, set Type to Function and press
OK
A dummy function is created. Fill it with code, and close VBA editor.
When you now activate Paste Function wizard in Excel, you can find created
UDF under category User Defined.

Some rules you have to follow:
By definition a function can't change anything - it only returns a value. So
you have to avoid according statements, like Select, Activate, etc.
To return a value, you have to save it to variable with same name as
function.

An example:
Public Sub Test(TestString As String) As String
Test=TestString
End Sub


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )



"CHRIS K" wrote in message
...
HOW do you do a UDF?
--
CHRISK


"Arvi Laanemets" wrote:

Hi


"CHRIS K" wrote in message
...
What's a UDF?



User Defined Function


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )