Data validation list entries all on one line in Excel (299490)



The information in this article applies to:

  • Microsoft Office Excel 2003
  • Microsoft Excel 2002
  • Microsoft Excel 2000

This article was previously published under Q299490

SYMPTOMS

When you run a Microsoft Excel macro or other programming code that sets data validation rules for a cell as a list of valid entries, all of the items in the data validation list on the cell appear on one line.

CAUSE

This behavior occurs when the following conditions are true:
  • The List Separator setting (under Regional Options in Control Panel) is something other than a Comma (,). For example, if your locale setting is Germany, your list separator is a semicolon.

    -and-
  • The macro for data validation uses that list separator to specify the valid cell entries.

    -and-
  • The macro code specifies the list explicitly, instead of pointing to a cell range where the valid entries are listed.

WORKAROUND

When you create a macro to specify a specific list of valid entries, always use a comma (,) as your list separator.

MORE INFORMATION

In Excel, Microsoft Visual Basic for Applications always uses the comma as the list separator. This allows you to run a macro on computers that have different locale settings, without having to edit your code.

When you run a macro that uses a list separator to change a setting, the macro converts the comma to the local regional list separator. For example, this occurs if the macro creates a data validation list, or enters a formula in a cell by using the Range.Formula(number1,number2) command.

REFERENCES

For additional informationabout data validation in Excel, click the article number below to view the article in the Microsoft Knowledge Base:

211485 XL: Description and Examples of Data Validation


Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbdtacode kbpending kbprb KB299490