View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark \(InWales\)[_8_] Mark \(InWales\)[_8_] is offline
external usenet poster
 
Posts: 1
Default Userform with validation...

I have a textbox on my userform that I am trying to add validation to i.e.
only allow a whole number between 1 - 21. I have recorded a macro to show
me the correct(?) code but I don't seem to be able to make the textbox the
active control apart from to take the focus?

With Selection.Validation
.Delete
.Add Type:=xlValidateWholeNumber, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="1", Formula2:="21"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Error"
.InputMessage = ""
.ErrorMessage = _
"You are trying to exced the total cube of the container 65,000 m3?
Please enter a figure between 1 - 21"
.ShowInput = True
.ShowError = True
End With

Please help if your able

Mark(InWales)