ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Commas in VBE Data Validation List (https://www.excelbanter.com/excel-programming/326176-commas-vbe-data-validation-list.html)

Paige

Commas in VBE Data Validation List
 
Am using VBA for data validation lists. One of my lists has
commas within each item, example:
Sales, Marketing and Administration
Parts, Planning
Excel however interprets each comma as 'start the next
item on the next line', so I get in my list:
Sales
Marketing and Administration
Parts
Planning
How do I fix this please? I was thinking it was by using a code (like
CHR(13) is used for carriage return), but can't find anything. So far I have
(all on one line
in the code version):

xlBetween,Formula1:="Sales, Marketing and Administration, Parts, Planning"

Any assistance is appreciated!

Debra Dalgleish

Commas in VBE Data Validation List
 
If you store the list in a named range on a worksheet, you can refer to
that range as the list source. When a cell in the range contains a
comma, the entire cell will be treated as one item in the list.


Paige wrote:
Am using VBA for data validation lists. One of my lists has
commas within each item, example:
Sales, Marketing and Administration
Parts, Planning
Excel however interprets each comma as 'start the next
item on the next line', so I get in my list:
Sales
Marketing and Administration
Parts
Planning
How do I fix this please? I was thinking it was by using a code (like
CHR(13) is used for carriage return), but can't find anything. So far I have
(all on one line
in the code version):

xlBetween,Formula1:="Sales, Marketing and Administration, Parts, Planning"

Any assistance is appreciated!



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


Paige

Commas in VBE Data Validation List
 
Works great - thanks, Debra!!!!

"Debra Dalgleish" wrote:

If you store the list in a named range on a worksheet, you can refer to
that range as the list source. When a cell in the range contains a
comma, the entire cell will be treated as one item in the list.


Paige wrote:
Am using VBA for data validation lists. One of my lists has
commas within each item, example:
Sales, Marketing and Administration
Parts, Planning
Excel however interprets each comma as 'start the next
item on the next line', so I get in my list:
Sales
Marketing and Administration
Parts
Planning
How do I fix this please? I was thinking it was by using a code (like
CHR(13) is used for carriage return), but can't find anything. So far I have
(all on one line
in the code version):

xlBetween,Formula1:="Sales, Marketing and Administration, Parts, Planning"

Any assistance is appreciated!



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html




All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com