Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 303
Default validate entry via messagebox

I need to be able to ensure that an answer to a message box is either A,a,B
or b
if anything else is entered the macro should display a message and exit the
routine or re-display the message for a new entry.
thanks
Bill K


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default validate entry via messagebox

A Message box does not allow for entry by a user. Assuming you mean InputBox
here is one method:

Response = Application.InputBox("Enter a string". "Alpha Characters", Type:=2)

While this will prevent returning numeric, date, time and other non-string
data types, it does not restrict the entry to alpha characters.

You would need to use scripting to construct a pattern to validate the entry
against.
I am just beginning to work with Scripting and have not developed that
expertise as yet.




"Bill Kuunders" wrote:

I need to be able to ensure that an answer to a message box is either A,a,B
or b
if anything else is entered the macro should display a message and exit the
routine or re-display the message for a new entry.
thanks
Bill K



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 303
Default validate entry via messagebox

Thanks for that.
I eventually got some code working to go back to the input box if the entry
was not
an A a B or b
Bill

"JLGWhiz" wrote in message
...
A Message box does not allow for entry by a user. Assuming you mean
InputBox
here is one method:

Response = Application.InputBox("Enter a string". "Alpha Characters",
Type:=2)

While this will prevent returning numeric, date, time and other non-string
data types, it does not restrict the entry to alpha characters.

You would need to use scripting to construct a pattern to validate the
entry
against.
I am just beginning to work with Scripting and have not developed that
expertise as yet.




"Bill Kuunders" wrote:

I need to be able to ensure that an answer to a message box is either
A,a,B
or b
if anything else is entered the macro should display a message and exit
the
routine or re-display the message for a new entry.
thanks
Bill K





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validate Entry Mike H. Excel Programming 0 June 28th 07 10:00 AM
MsgBox to validate an entry TimN Excel Programming 6 July 21st 06 09:08 PM
Validate InputBox entry davidm Excel Programming 0 August 31st 05 03:03 AM
Validate textbox entry Stuart[_21_] Excel Programming 2 May 13th 05 07:31 PM
Validate Combobox entry MBlake Excel Programming 5 May 4th 05 08:39 PM


All times are GMT +1. The time now is 12:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"