ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   call a function from VBA (https://www.excelbanter.com/excel-programming/325402-call-function-vba.html)

Adam

call a function from VBA
 
I have some functions in VBA e.g. one that is called
Function CountByColor(InRange As Range, WhatColorIndex As Integer, Optional
OfText As Boolean = False) As Long.

When i write =CountByColor(A2:A4;3;FALSE) in my worksheet it returns #NAME?.
What am I doing wrong?


Adam

call a function from VBA
 
problem solved, pls disregard

"Adam" skrev:

I have some functions in VBA e.g. one that is called
Function CountByColor(InRange As Range, WhatColorIndex As Integer, Optional
OfText As Boolean = False) As Long.

When i write =CountByColor(A2:A4;3;FALSE) in my worksheet it returns #NAME?.
What am I doing wrong?


Bob Phillips[_6_]

call a function from VBA
 
Adam,

Two things spring to mind.

Have you stored the code in a general code module (not a form, sheet module
or ThisWorkbook)?

Also, but I don't think this is the problem, you are using continental
separators (; not ,). Is this correct for your Excel?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Adam" wrote in message
...
I have some functions in VBA e.g. one that is called
Function CountByColor(InRange As Range, WhatColorIndex As Integer,

Optional
OfText As Boolean = False) As Long.

When i write =CountByColor(A2:A4;3;FALSE) in my worksheet it returns

#NAME?.
What am I doing wrong?





All times are GMT +1. The time now is 01:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com