Compile Error Case Else Outside Select Case
Forums Excel Questions Compile Error: Case Else Outside Case Select Case Results 1 to 7 of 7 Compile Error: Case Else Outside Case Select CaseThis is a discussion on Compile Error: Case Else Outside Case Select Case within the Excel Questions forums, part of the Question Forums category; Hi, Can someone help me with this. I can't figure out how to fix this error message. Thanks. Private Sub ... LinkBack LinkBack URL About LinkBacks Bookmark & Share Digg this Thread!Add Thread to del.icio.usBookmark in TechnoratiTweet this thread Thread Tools Show Printable Version Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Jan 6th, 2010,12:29 PM #1 romeoshakes New Member Join Date Jun 2009 Posts 14 Compile Error: Case Else Outside Case Select Case Hi, Can someone help me with this. I can't figure out how to fix this error message. Thanks. Private Sub Worksheet_Change(ByVal Target As Range) Select Case Me.Range("J4") Case "Weekly", "Weekly" With Me Sheets("Test").Unprotect Password:="$test$" Me.Cells.Locked = True Me.Cells.FormulaHidden = False .Range("D10:D12, D15:D16, D40:D49").Locked = False Range("C3:E5,C10:C12,C22:C29,C32:C34,E32,E40:F49,I3:J4,L5:M5").Locked = False .Range("J4").Locked = False .Protect Select Case Me.Range("Q8") Case "Monthly", "Monthly" With Me Sheets("CPR - TAXServices").Unprotect Password:="$cpr$" Me.Cells.Locked = True Me.Cells.FormulaHidden = False Range("C22:C29").Locked = True Protect Case Else With Me Sheets("Test").Unprotect Password:="$test$" Me.Cells.Locked = True Me.Cells.FormulaHidden = False .Range("D14:D16, D40:D49").Locked = False Range("C3:E5,C10:C12,C22:C29,C32:C34,E32,E40:F49,I3:J4,L5:M5").Locked = False .Range("J4").Locked = False .Protect End Sele
Question Need help? Post your question and get tips & solutions from a community of 418,469 IT Pros & Developers. It's quick & easy. Compile error: End Select without Select Case P: 46 Vasago I am getting a this compile error on line 22 and I do have the Select case and End Select. Expand|Select|Wrap|Line Numbers SelectCase[BookingStatus] Case1 DoCmd.OpenReport"CharterOrderForm",wherecondition:="Bookings.ID='"&Forms![CharterOrderForm]![ID]&"'" Case2 If[Invoice#]=0Then tempinvoiceid=(DMax("Invoice#","Invoices")+1) Setdb=CurrentDb.OpenRecordset("Invoices") db.AddNew db![Invoice#]=(DMax("Invoice#","Invoices")+1) db![Amount]=Me![QuotePrice] db![BilledDate]=Now() db![TripDate]=Me![Date] http://www.mrexcel.com/forum/excel-questions/439389-compile-error-case-else-outside-case-select-case.html db![School]=Me.Client db![SchoolID]=Me.[SchoolID] db![Discription]=[NumberofBuses]&_ "Bus(es)From"&[PickupPointName]&_ "To"&[DestinationName] IfTrip_Type="FieldTrip"Then Else db![Route]=-1 EndIf db.Update DoCmd.OpenReport"InvoiceFromCharter",_ wherecondition:="[Invoice#]="&_ tempinvoiceid&"" EndSelect Does it have anything to do with the operations preformed in the cases? Apr 28 '14 #1 Post Reply Share this Question 3 Replies 100+ P: 269 Luk3r This may not be what's causing it... but you are missing an End https://bytes.com/topic/access/answers/956352-compile-error-end-select-without-select-case If for your first If statement. Apr 28 '14 #2 reply Expert 100+ P: 1,204 jimatqsi That most likely is causing it. You'll get an error similar to that whenever you forget a terminator for if/Then, Select Case, For/Next and With/End. Depends which one came first as to what particular error message you see. Jim Apr 28 '14 #3 reply Expert Mod 2.5K+ P: 4,993 zmbd That's the ticket, the "IF" at line 5 doesn't have a matching "End IF" prior to line 26. I've properly "stepped" your code. >HOWEVER< the stepping is based on what you have coded and as related to how the functions relate (ie line 18 thru 21 - even though I'm certain you intended that "else" to be part of the outter if, I stepped it as though it belonged to the closer "if" construct) Apr 29 '14 #4 reply Message Cancel Changes Post your reply Join Now >> Sign in to post your reply
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn http://stackoverflow.com/questions/18462390/compile-error-invalid-outside-procedure more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Compile error: invalid outside procedure up vote -2 down vote compile error favorite I m trying to make a excel vba based calculator witch post the out put result to a specific cell in excel sheet but when i am trying to call the user form an error occurred Compile error: invalid outside procedure my code of macro is as under 'Declare the global variables to be used throughout the form Dim mfirst As Single Dim msecond As Single Dim compile error case manswer As Single ' Declare the global variables for the operators: Add,Sub,Mul and DIV Dim mbutton As Integer Dim ws As Worksheet Set ws = Worksheet("entry") ws.Range("b4").Value = manswer 'Change the sign of the number from + or - or vice versa ' Depending on its state now they show in txtNUMBER text box Dim Signstate As Boolean Private Sub Backspc_Click() TXTnumber = Len(TXTnumber) - 1 End Sub Private Sub cmd0_Click() 'Put the value 0 into the txtNUMBER text box TXTnumber = TXTnumber + "0" End Sub Private Sub cmd1_Click() 'Put the value 1 into the txtNUMBER text box TXTnumber = TXTnumber + "1" End Sub Private Sub cmd2_Click() 'Put the value 2 into the txtNUMBER text box TXTnumber = TXTnumber + "2" End Sub Private Sub cmd3_Click() 'Put the value 3 into the txtNUMBER text box TXTnumber = TXTnumber + "3" End Sub Private Sub cmd4_Click() 'Put the value 4 into the txtNUMBER text box TXTnumber = TXTnumber + "4" End Sub Private Sub cmd5_Click() 'Put the value 5 into the txtNUMBER text box TXTnumber = TXTnumber + "5" End Sub Private Sub cmd6_Click() 'Put the value 6 into the txtNUMBER text box TXTnumber = TXTnumber + "6" End Sub Private