Validatio Problem

H

halem2

I received the following answer from Greg Jones but I'm having a proble
passing the actual entered value to the cell. The pop up box pops u
and I'm able to type the value, which it validates but it does no
input the value in the cell. This is Greg's answer

Hi Halem2;

Use this:

Sub try()

Dim Message, Title, Default, MyValue
Message = "Enter a number that has 5 characters" ' Set
prompt.
Title = "InputBox Demo" ' Set title.
Default = "12345" ' Set default.

' Display message, title, and default value.
MyValue = InputBox(Message, Title, Default)

If Not IsNumeric(MyValue) Or Not Len(MyValue) = 5 Then
MsgBox "you can't do that"

End If





End Sub


Thanks Greg for your help
 
T

Tom Ogilvy

Sub try()

Dim Message, Title, Default, MyValue
Message = "Enter a number that has 5 characters" ' Set
prompt.
Title = "InputBox Demo" ' Set title.
Default = "12345" ' Set default.

' Display message, title, and default value.
MyValue = InputBox(Message, Title, Default)

If Not IsNumeric(MyValue) Or Not Len(MyValue) = 5 Then
MsgBox "you can't do that"
Else
Range("B9").Value = MyValue

End If





End Sub
 
Top