LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Loop Enumeration Constants

All,

I'm curious to know if there is a way to loop through the constants of an
enumeration. (Or, maybe another way to put this is this: Is there a way to
get an enumeration as a collection?)

I'll illustrate with a simple example below ("TestEnumLoop"), which puts the
constants of XlYesNoGuess into an array, loops through the array, and prints
the constant values to the Immediate Window. (Continue reading after
"TestEnumLoop" for the "hypothetical code").

Sub TestEnumLoop()
Dim varArr As Variant
Dim varItem As Variant
'Dim xlEnum As XlYesNoGuess

varArr = Array(xlGuess, xlNo, xlYes)

For Each varItem In varArr
Debug.Print varItem
Next varItem

End Sub

So, I'm curious to know if there is some way to loop through the
"collection" of constants for a given enumeration. For example, is there
something that would exist for the "hypothetical code" below?

Sub HypotheticalLoop()
Dim xlEnum As XlYesNoGuess

For Each xlEnum In XlYesNoGuess
Debug.Print xlEnumTest
Next xlEnum

End Sub

Thanks,

Matthew Herbert


 
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
enumeration members adewole Excel Worksheet Functions 1 June 14th 07 06:38 PM
enumeration by vba or by matric or both PST Excel Programming 0 June 3rd 07 12:05 PM
VSTO Cell Alignment Enumeration Bob Sullentrup Excel Programming 5 October 10th 05 07:56 PM
Enumeration stck2mlon[_3_] Excel Programming 6 June 2nd 04 02:54 PM
Using enumeration with controls UgetSpam Excel Programming 2 November 27th 03 06:57 PM


All times are GMT +1. The time now is 05:30 AM.

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

About Us

"It's about Microsoft Excel"