ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Validation-List created with VBA (https://www.excelbanter.com/excel-programming/310545-validation-list-created-vba.html)

falstaff

Validation-List created with VBA
 

Hello,

I have a problem. I would like to make a Validationlist, for a Cell
with more than one Values. (Test and Test2). I recorded a macro:


Code
-------------------

Sub Makro2()
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Test;Test2"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub

-------------------


After i did this over the Excel Menu's, in the active cell was a Lis
with 2 Values (Test and Test2, in 2 single Lines).

But when I execute this Code, for another Cell, only 1 Line is ther
but with 2 Vales in a row: Test;Test2 (with the ";").... :(

I use Excel 2003.

Thanks for any suggestions

falstaf

--
falstaf
-----------------------------------------------------------------------
falstaff's Profile: http://www.excelforum.com/member.php...fo&userid=1453
View this thread: http://www.excelforum.com/showthread.php?threadid=26156


JulieD

Validation-List created with VBA
 
Hi

this works for me
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Test" & "," & "Test2"

i'm not sure if there is a difference with international / regional settings
so you might like to try
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Test" & ";" & "Test2"

Let us know how you go

Cheers
JulieD

"falstaff" wrote in message
...

Hello,

I have a problem. I would like to make a Validationlist, for a Cell,
with more than one Values. (Test and Test2). I recorded a macro:


Code:
--------------------

Sub Makro2()
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Test;Test2"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub

--------------------


After i did this over the Excel Menu's, in the active cell was a List
with 2 Values (Test and Test2, in 2 single Lines).

But when I execute this Code, for another Cell, only 1 Line is there
but with 2 Vales in a row: Test;Test2 (with the ";").... :(

I use Excel 2003.

Thanks for any suggestions

falstaff


--
falstaff
------------------------------------------------------------------------
falstaff's Profile:

http://www.excelforum.com/member.php...o&userid=14533
View this thread: http://www.excelforum.com/showthread...hreadid=261564





All times are GMT +1. The time now is 05:11 PM.

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