Greetings!
I've got a wee problem with using xlValidateList and just wanted to check whether I was doing it right or whether it was an Excel quirk. Using both 2003 and 2007 'flavours' of Excel.
I want to restrict users to the entry of either 1,2 or 3 on a cell which is formatted not to show decimal places. Despite giving a drop-down list, it has been discovered that some are entering 0.5, which is accepted and shown as 1. Testing the sheet, it would appear that 0.49 is not acceptable, nor is 3.5, but numbers between 0.5 and 3.4999 are.
I can use the xlValidateWholeNumber, but then I lose the drop down list. Curiously enough, should I fill 3 cells with 1, 2 and 3 respectively and then reference them as the Formula1, then non-integer entry is blocked.
Any thoughts and views on this "funny"?
Thanks,
lex
soi la, soi carré
I've got a wee problem with using xlValidateList and just wanted to check whether I was doing it right or whether it was an Excel quirk. Using both 2003 and 2007 'flavours' of Excel.
I want to restrict users to the entry of either 1,2 or 3 on a cell which is formatted not to show decimal places. Despite giving a drop-down list, it has been discovered that some are entering 0.5, which is accepted and shown as 1. Testing the sheet, it would appear that 0.49 is not acceptable, nor is 3.5, but numbers between 0.5 and 3.4999 are.
I can use the xlValidateWholeNumber, but then I lose the drop down list. Curiously enough, should I fill 3 cells with 1, 2 and 3 respectively and then reference them as the Formula1, then non-integer entry is blocked.
Code:
Range("A1").NumberFormat = "0"
With Range("A1").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="1,2,3"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = "Number must either 1, 2 or 3"
.ShowInput = True
.ShowError = True
End With
Any thoughts and views on this "funny"?
Thanks,
lex
soi la, soi carré