View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Validatio Problem

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

--
Regards,
Tom Ogilvy

"halem2 " wrote in message
...
I received the following answer from Greg Jones but I'm having a problem
passing the actual entered value to the cell. The pop up box pops up
and I'm able to type the value, which it validates but it does not
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.


---
Message posted from http://www.ExcelForum.com/