Validation-List created with VBA

F

falstaff

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
 
J

JulieD

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top