SunQuest
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old May 29th, 2003, 03:24 AM
barkley barkley is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 4 barkley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
If Else Statement Error

I have an input box where a user inserts a contract reference. This then is used by Excel to do various actions.
What I want to be able to do is include an 'else' so that if the user inserts an invalid reference the resulting '#N/A' error doesn't give me a 'Runtime Error 13'.
I am guessing that I need to put an else Iserror code in somehow but since this is the first bit of VB I have ever written without using the record macro button in Excel I'm a bit stumped.
Code so far is as follows:

Sub Selection()

crit = Inputbox("Please Enter a Contract Reference Number:", "Enter Contract Reference")
Range("B5").Select
Range("B5") = crit

If Range("C13") = "S/O" Then

MsgBox prompt:="Warning! This is a Scheduled Order. Please ensure you have input the Contract Reference correctly.", Buttons:=vbOKOnly + vbCritical, Title:="WARNING!"

' I am guessing my else iserror part should be in here...

End If

End Sub

Thanks in advance.

Reply With Quote
  #2  
Old May 29th, 2003, 12:42 PM
Christoph2k Christoph2k is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: London, UK
Posts: 19 Christoph2k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 43 m 24 sec
Reputation Power: 0
You could do something like

On Error Resume Next

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > If Else Statement Error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway