troubleshooting Question

Wasn't there an INLIST function at one time?

Avatar of RichNH
RichNH asked on
Microsoft OfficeVisual Basic ClassicMicrosoft Excel
3 Comments1 Solution1924 ViewsLast Modified:
For some reason I seem to remember some function that allowed you to test if a string was in a list of specific values.  I'm working in Excel 2007 VBA...

My code looks like this

If Mid(txtSN, 4, 2) <> "01" And Mid(txtSN, 4, 2) <> "02" And Mid(txtSN, 4, 2) <> "03" And Mid(txtSN, 4, 2) <> "04" And Mid(txtSN, 4, 2) <> "05" And Mid(txtSN, 4, 2) <> "06" And Mid(txtSN, 4, 2) <> "07" And Mid(txtSN, 4, 2) <> "08" And Mid(txtSN, 4, 2) <> "09" And Mid(txtSN, 4, 2) <> "10" And Mid(txtSN, 4, 2) <> "11" And Mid(txtSN, 4, 2) <> "12" Then
            MsgBox "Serial # not in correct format, digits in positions 5-6 should be 01-12, YY-0MM-###"

And I wanted to write sometime like this
If INLIST(mid(txtSN,4,2), "01,02,03,04,05,06,07,08,09,10,11,12" then  blah

But obviously that won't compute.

Anyone remember and how would I write it?  I'm not looking for custom code, just a canned function.

Rich
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros