Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 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!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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!
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
Change the values of cells by a fixed factor i.e. 10/100= 0.10 Onitto Excel Discussion (Misc queries) 2 June 2nd 10 03:40 PM
How do I add up texts as fixed number values in a row? john_8000 Excel Discussion (Misc queries) 7 December 10th 09 10:33 PM
Drop down box of names with fixed values? Soccer Guy Excel Worksheet Functions 5 December 27th 05 06:15 AM
drawdown at fixed rate over set period from investment at fixed % jamook New Users to Excel 1 November 28th 05 10:53 PM
how to divide all values with a fixed value ? fax Excel Discussion (Misc queries) 2 November 21st 05 07:12 PM


All times are GMT +1. The time now is 10:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"