LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
lwm lwm is offline
external usenet poster
 
Posts: 38
Default Case Statment in Err trapping

I am having trouble with the code in 2:

when I add this code:
ResPonse = MsgBox(prompt:=Msg, Buttons:=vbYesNo)
If ResPonse = vbNo Then
Exit Sub

Else
GoTo 2

I get an errror:

Case Else outside Select Case

When I remark out the Case Else I get the error:

End Select without Select Case

What is wron g with the code.

The statement that appears to be causing the problem

ResPonse = MsgBox(prompt:=Msg, Buttons:=vbYesNo)
If ResPonse = vbNo Then
Exit Sub

Else
GoTo 2


Is giving the user a choice of continuing or quiting.

Thank you for your help and hopefully I have provided enough detail.



Badinput:
Select Case Erl
Case Is = 1
Msg = "Error! " & Esp & "You must Enter numbers between " & TabMin & Esp
& TabMax & _
vbCr & vbCr & " rerun Macro"
MsgBox Buttons:=vbCritical, prompt:=Msg

MsgBox "Ending program now"
Application.StatusBar = False
Application.ScreenUpdating = True

Case Is = 2
Msg = "Error! " & Esp & "Dublicate Tab name " & Esp & NewSheet & _
vbCr & vbCr & " Enter a unique Tab name"
' MsgBox prompt:=Msg, Buttons:=vbCritical
ResPonse = MsgBox(prompt:=Msg, Buttons:=vbYesNo)
If ResPonse = vbNo Then
Exit Sub

Else
GoTo 2

Case Else
Msg = "ending program"
MsgBox Msg
Exit Sub

End Select
 
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
change data of entire column from small case to upper case Ann Excel Worksheet Functions 1 August 16th 08 01:06 PM
Changing multiple cell text from lower case to upper case Patti Excel Discussion (Misc queries) 2 January 4th 08 08:35 PM
IF STATMENT OR CASE STATEMENT Richard Excel Discussion (Misc queries) 2 January 10th 07 10:04 AM
Making a C++ like if statment case for excel in VBA Jimmy Hoffa Excel Programming 1 August 16th 05 08:21 PM
Fix If statment to accept Upper or Lower Case rleonard[_2_] Excel Programming 3 June 5th 04 10:54 PM


All times are GMT +1. The time now is 10:15 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"