![]() |
Parameters with fixed set of possible values
How do I make a subroutine with a parameter that has a fixed set of
possible values? I want something similar to the box that pops up for a boolean with only 'true' and 'false' options. Also, is it possible to populate the pop up box with options such as 'red', 'blue' that correspond to values such as '1', '2'? ------ Aaron *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Parameters with fixed set of possible values
do you mean in the VBE? Where does this box popup with True and False?
-- Regards, Tom Ogilvy "Aaron" wrote in message ... How do I make a subroutine with a parameter that has a fixed set of possible values? I want something similar to the box that pops up for a boolean with only 'true' and 'false' options. Also, is it possible to populate the pop up box with options such as 'red', 'blue' that correspond to values such as '1', '2'? ------ Aaron *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Parameters with fixed set of possible values
Aaron,
In Excel 2000 or later, you can use Enum type variables. For example, Public Enum MyEnum Red = 1 Blue = 2 End Enum Then, declare the argument to the procedure As MyEnum. For example, Sub Test(WhatColor As MyEnum) ' your code here End Sub Finally, you can use a value of the enum in the code that calls the procedure. Test WhatColor:=Blue -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Aaron" wrote in message ... How do I make a subroutine with a parameter that has a fixed set of possible values? I want something similar to the box that pops up for a boolean with only 'true' and 'false' options. Also, is it possible to populate the pop up box with options such as 'red', 'blue' that correspond to values such as '1', '2'? ------ Aaron *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Parameters with fixed set of possible values
Great!. Thanks for the help. This is exactly what I was looking for.
------ Aaron *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
All times are GMT +1. The time now is 01:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com