ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data Validation error (https://www.excelbanter.com/excel-programming/416996-data-validation-error.html)

Lico_VBA

Data Validation error
 
when i recorded this macro the excel displayed the list normally, but when i
execute this code then excel shows one line in the list with "a;b;c".

Does anyone knows how to make excel display three lines ( "a" , "b", "c")?

Sub Macro2()
' Macro2 Macro
'
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="a;b;c"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub




Rick Rothstein

Data Validation error
 
Change the semi-colons (;) to commas...

...,Formula1:="a,b,c"

--
Rick (MVP - Excel)


"Lico_VBA" wrote in message
...
when i recorded this macro the excel displayed the list normally, but when
i
execute this code then excel shows one line in the list with "a;b;c".

Does anyone knows how to make excel display three lines ( "a" , "b", "c")?

Sub Macro2()
' Macro2 Macro
'
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=
_
xlBetween, Formula1:="a;b;c"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub





Doug Glancy

Data Validation error
 
Change your semicolons to commas:

xlBetween, Formula1:="a,b,c"

hth,

Doug

"Lico_VBA" wrote in message
...
when i recorded this macro the excel displayed the list normally, but when
i
execute this code then excel shows one line in the list with "a;b;c".

Does anyone knows how to make excel display three lines ( "a" , "b", "c")?

Sub Macro2()
' Macro2 Macro
'
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=
_
xlBetween, Formula1:="a;b;c"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub







All times are GMT +1. The time now is 01:49 PM.

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