#1   Report Post  
Posted to microsoft.public.excel.misc
lee lee is offline
external usenet poster
 
Posts: 184
Default User define function

how to make my vba function available in new worksheet
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default User define function

Care to post it?

--
Don Guillett
SalesAid Software

"Lee" wrote in message
...
how to make my vba function available in new worksheet



  #3   Report Post  
Posted to microsoft.public.excel.misc
lee lee is offline
external usenet poster
 
Posts: 184
Default User define function

Public Function leesort(s As String) As String
Dim c As Integer
Dim d As Integer
Dim temp As String
Dim ss(1000) As String

For c = 1 To Len(s)
ss(c) = Mid(s, c, 1)
Next c
For c = 1 To Len(s)
For d = 1 To Len(s) - 1
If ss(d) ss(d + 1) Then
temp = ss(d + 1)
ss(d + 1) = ss(d)
ss(d) = temp
End If
Next d
Next c

leesort = ""
For c = 1 To Len(s)
leesort = leesort + ss(c)
Next c


End Function


"Don Guillett" wrote:

Care to post it?

--
Don Guillett
SalesAid Software

"Lee" wrote in message
...
how to make my vba function available in new worksheet




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default User define function

You mean a new workbook?

Lots of people put this kind of thing in their personal.xls and store that file
in their XLStart folder. (But you don't need to.) But by having the file in
the XLStart folder, then excel will open it each time it starts--so those
functions are always available.

In any case, you'll have to have the workbook with the function open to use it
in other workbooks.

Then you can use it like this:
=personal.xls!leesort(a1)

Another option is to save that personal file as an addin (I use personal.xla)
and keep it in your XLStart folder.

Then you can use this:
=leesort(a1)

Just like a function built into excel.

====
Just a warning note.

If you're going to share this workbook with this function with others, don't
call it personal.xls (or personal.xla). The other users may have stuff in their
own personal.xl* files and need their files open instead.

Call your workbook:

LeeUtils.xls
or
LeeUtils.xla

Then tell your users to store that file in a specific folder (C:\ExcelUtils,
say). Then you'll be able to share files that use these functions with no
problem.

If you end up using an addin, tell the users to install the addin via:
tools|addins|browse to
c:\ExcelUtils
and turn it on.




Lee wrote:

how to make my vba function available in new worksheet


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default User define function

You can place it in your Personal Macro Workbook, more commonly known as
Personal.xls

When stored in the XLSTART folder, Personal.xls will open whenever you start
Excel.

You can save it "hidden" so it stays in the background with your macros and
functions available for all open workbooks.

When using Personal.xls and assigning macros to buttons you have to precede the
macroname with the filename.

i.e. Personal.xls!mymacro

Same thing for User Defined Functions

=Persoanl.xls!funcname(args)

If you store all macros and UDF's in an Add-in(*.xla) you don't need the
filename.

=funcname(args) is sufficient.


Gord Dibben MS Excel MVP

On Sat, 10 Feb 2007 15:11:00 -0800, Lee wrote:

how to make my vba function available in new worksheet


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
LINKEDRANGE function - a complement to the PULL function (for getting values from a closed workbook) [email protected] Excel Worksheet Functions 0 September 5th 06 03:44 PM
Need some comments on my Utility_Move class module. jchen Excel Worksheet Functions 0 August 21st 06 07:05 PM
User Defined Function Samad Excel Discussion (Misc queries) 14 November 16th 05 12:32 PM
clock Wildman Excel Worksheet Functions 2 April 26th 05 10:31 AM
how to move user defined function Grant Excel Worksheet Functions 1 November 17th 04 06:38 PM


All times are GMT +1. The time now is 05:13 AM.

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"