Jumat, 21 Oktober 2016

Re: [ExcelVBA] failing function

 



"Public"?  I.e.
 
Public Function Func(ByVal x as range, y as range) as variant
 
Not sure about the ByVal on the range, either.  You might need ByRef on both parameters.  As in
 
Public Function Func(ByRef x as range, ByRef y as range) as variant
 
Lastly, avoid a return type of Variant if you can - give it a more appropriate return type (unless, of course, you are returning various types).

Regards, Dave S
 
----- Original Message -----
Sent: Saturday, October 22, 2016 1:09 AM
Subject: [ExcelVBA] failing function


I am trying to create a Function

I create a module (module1 in General Declaration)

I put in the code

 
Function Func(ByVal x as range, y as range) as variant

---- my code ----

Function End


in the spreadsheet I put in   =Func(A1:E1,A2:E2)


The results are VALUE error

I try to run the Function in VBA Editor and it keeps asking for a Macro Name.


I am missing something simple I am sure, but what is it?


Thanks for responding to this.

 Greg


__._,_.___

Posted by: "David Smart" <smartware.consulting@gmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.

----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------

.

__,_._,___

Tidak ada komentar:

Poskan Komentar