4

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.

Lork
  • 103
  • 5
  • See https://www.pcreview.co.uk/threads/get-list-separator-character-with-vba.2218762/ – Olly Aug 15 '17 at 18:46

1 Answers1

8

You can use the property below; which returns the type of separator as a string.

  Application.International(xlListSeparator)
Slaqr
  • 528
  • 3
  • 8