LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA IF statements

Joanne,

You can do a

If var < value Then

so if you want to test for something other than the list you give then

If ans < "None" Then

as an example

You can also use Like

If ans Like "M*" Then

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Joanne Toone" wrote in message
...
I was wondering if you can do an if statement that says "if input isn't
.. then ...". Below is the code im trying to sort out, and i think
you'll understand once you see it!

ActiveCell.Offset(0, 1).Range("A1").Select
ans = Application.InputBox("Enter the customer title: ", _
"Customer Title", Type:=2) ' Type 2 for a text entry
If ans = "Miss" Or ans = "Mr" Or ans = "Ms" Or ans = "Mrs"
Then
MsgBox "Please input an appropriate title", vbOKOnly +
vbCritical, "Incorrect Input"
Application.Run "InputMe"
Exit Sub
End If
ActiveCell.Offset.Range("A1") = ans


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





 
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
If statements Pippa Excel Discussion (Misc queries) 1 May 30th 08 02:11 PM
IF Statements (Mutliple Statements) Deezel Excel Worksheet Functions 3 October 19th 06 06:13 AM
using if statements LAybar Excel Worksheet Functions 4 March 20th 06 02:55 PM
if statements qwerty_2006 Excel Worksheet Functions 3 March 12th 06 08:09 AM
IF and OR statements Loraloo Excel Discussion (Misc queries) 3 March 4th 06 11:42 PM


All times are GMT +1. The time now is 10:39 PM.

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"