Strangely enough, yesterday for the first time in a very long time, I needed to stop by the Lounge to ask a question and it wasn’t coming up. I was a little bummed that this great resource was gone. Glad to see it was just a DNS issue.
Anyway, is there a language feature in VBA that allows you to check for membership in an array, collection, or dictionary?
In Python you can do
dwarves = [‘grumpy’, ‘dopey’, ‘sleepy’, ‘happy’]
dwarf = ‘grumpy’
if dwarf in dwarves
Perl has something similar like
if grep $dwarf @dwaves
Is there some sort of construct in VBA that you can do this? I was in Excel and I only need to process a set of sheets in a workbook. I couldn’t find anything to do something like
if sheetname in sheetnames
I ended up writing a function that uses a Select Case statement with each case being a sheetname. I could have done a big if statment with a pile of “or”s.
Am I missing something?
Thanks.