Not all configurations of Excel use the same list separator symbol. In particular, it is common for Excel to use "," as the list separator in the United States and ";" as the list separator in Europe. Among other things, this affects the syntax for disjoint ranges. The same range may be formally expressed as "Sheet0!A1:B2,Sheet0!C3:D4" on one computer, but "Sheet0!A1:B2;Sheet0!C3:D4" on another computer.
I am writing code to manipulate disjoint ranges. I need to know when to use the "," syntax and when to use the ";" syntax (or, perhaps, when to use something completely different). How can I figure out what syntax to use?
Note that I'm aware that I can read the list separator from the regional settings (as described here). However, I don't want to know the regional setting per se; I want to know Excel's setting. Perhaps they are always the same, but I've seen no claim to that effect.
I'm looking for a solution for all versions of Excel, 2010 and newer. I'm using C# and Excel-DNA, but I would be grateful for a solution in any language.
You can use the property below; which returns the type of separator as a string.
Application.International(xlListSeparator)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With