ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   trouble w/ creating a VBA function that uses an enum in it's parameters (https://www.excelbanter.com/excel-programming/336066-trouble-w-creating-vba-function-uses-enum-its-parameters.html)

[email protected]

trouble w/ creating a VBA function that uses an enum in it's parameters
 
Greetings,

I have an enum that I use as a variable in a function. If I call on
the function from w/in the VBA IDE, the enum values are displayed, but
not when I call on the function from w/in Excel.

I have tried all sorts of things, but I am at my wit's end. Here is
the code...

Public Enum To_Unit
eMinute = 1
eHour = 2
eDay = 3
eWeek = 4
eMonth = 5
End Enum

Public Function ChangeUnit(Target As Range, ToUnit As To_Unit) As Long


Thanks in advance,
Jacob


Rob Bovey

trouble w/ creating a VBA function that uses an enum in it's parameters
 
Hi Jacob,

If you mean that Excel doesn't display the text values of your
enumeration members when you use your function as a worksheet function, it's
because Excel doesn't support this feature for worksheet functions.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

wrote in message
oups.com...
Greetings,

I have an enum that I use as a variable in a function. If I call on
the function from w/in the VBA IDE, the enum values are displayed, but
not when I call on the function from w/in Excel.

I have tried all sorts of things, but I am at my wit's end. Here is
the code...

Public Enum To_Unit
eMinute = 1
eHour = 2
eDay = 3
eWeek = 4
eMonth = 5
End Enum

Public Function ChangeUnit(Target As Range, ToUnit As To_Unit) As Long


Thanks in advance,
Jacob




Jacob

trouble w/ creating a VBA function that uses an enum in it's parameters
 
OK, that would answer it. Thanks.



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

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