LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Why Error Message "End Select without Select Case"?


The following is a modification of a procedure to create a first-shee
"Index" of all worksheets in a workbook that's located in multipl
places around the Web. I do not want it to create index entries for th
Index sheet and two others with the names "MenuSheet" and "Ne
Customer".

But when it runs, it generates the compile error ""End Select withou
Select Case" even though there's clearly a Select Case statement an
only one.

What's wrong here?


Code
-------------------
Private Sub Worksheet_Activate()
Dim wSheet As Worksheet
Dim wSheetIndex As Long
Dim M As Long
M = 1
Application.ScreenUpdating = False
ActiveSheet.Unprotect ' Unprotect "Index" sheet
With Me
.Columns(1).ClearContents
.Cells(1, 1) = "Customer Index"
.Cells(1, 1).Name = "Index"
End With

For Each wSheet In Worksheets
' Don't want an index entry for MenuSheet or New Customer
Select Case wSheet.Name
Case Not Me.Name
Case Not "MenuSheet"
Case Not "New Customer"
Case Else
M = M + 2
' Add 'Return to Index' link on worksheet
' format it to bold yellow with full centering
With wSheet
.Unprotect
.Range("A1").Name = "Start" & wSheet.Index
.Hyperlinks.Add Anchor:=.Range("B1:C1"), Address:="", _
SubAddress:="Index", TextToDisplay:="Return to Index"
With .Cells.Range("B1:C1")
.Merge
.Interior.ColorIndex = 6
.Interior.Pattern = xlSolid
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Bold = True
.Borders(xlEdgeTop).LineStyle = xlContinuous
.Borders(xlEdgeBottom).LineStyle = xlContinuous
.Borders(xlEdgeRight).LineStyle = xlContinuous
.Borders(xlEdgeLeft).LineStyle = xlContinuous
End With
wSheet.Protect
End Select
Next wSheet
Application.ScreenUpdating = True
ActiveSheet.Protect ' Protect Index sheet
End Su
-------------------


Many thanks,

- A

--
GoFigur
-----------------------------------------------------------------------
GoFigure's Profile: http://www.excelforum.com/member.php...nfo&userid=427
View this thread: http://www.excelforum.com/showthread.php?threadid=49173

 
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
SELECT CASE "Jan-03" confusion Craigm[_13_] Excel Programming 2 June 27th 05 02:40 PM
Error Message "Select method of worksheet class failed" philc Excel Programming 5 May 4th 05 08:07 AM
Fix Code: Select Case and "Contains" selection Bettergains Excel Programming 5 April 26th 05 02:22 AM
VBA error 1004 "Select method of Range class failed" Matt J Excel Programming 6 July 3rd 04 10:05 PM
Error 1004, "select method of range class failed" paritoshmehta[_11_] Excel Programming 3 May 6th 04 10:09 PM


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