Dear all, it's late at night where I am and my brain is not working anymore (if it ever was): I want to build and evaluate a VBA expression by reading in a string with a VBA expression from a spreadsheet cell. The purpose is to match up tags based on recognized patterns. Given a tag pattern is recognized, I want to see if I can manipulate the string until I can find a match in a range. Example: ' Cell A1 contains the string "Mid(Tag,7,12) & Right(Tag)" and Tag is a string variable used in the VBA Function. How can I evaluate a TestTag based on this string:
... obviously doesn't work. If I coded all the different variants into the VBA code it would look like this:
.... which obviously does work. But it does not provide the clarity of a user-accessible table with all patterns and manipulation options laid out in a sheet. Any hints?
Code:
TestTag = Evaluate(Range("A1").Value)
Code:
TestTag = Mid(Tag,7,12) & Right(Tag)