Originally Posted by
eivstei
1. How does the ubound work in this vba?
Application.Caller returns the name of the clicked object.
Split(s, "-") creates an array by splitting the name into elements. In this case, the separator is a hyphen. The array formed by splitting the string is always indexed from 0.
UBound(v) returns the upper index of the array (LBound - the lower index).
In the following conditions, I check what the upper index is. If 0, it means that basically no division has taken place (there is no separator), which would indicate that it is the highest level - Country. If Ubound returns 1 it means that we are dealing with State.
Originally Posted by
eivstei
2. If I would add the next level "store_city" under state. Which solution would you recommend then?
On a similar basis as before. You create an object name "with an access path", e.g. "USA-CO-Denver". You add another condition. It would probably look like this
Artik
Bookmarks