Validatio Problem
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 -- Message posted from http://www.ExcelForum.com |
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/ |
All times are GMT +1. The time now is 09:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com