Results 1 to 5 of 5

Simple error: List multiple sheet names in Workbook_SheetActivate event

Threaded View

  1. #1
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Simple error: List multiple sheet names in Workbook_SheetActivate event

    Hi guys,

    I hope you can help.

    It should be something really simple.

    I want a warning to appear when one activates certain sheets. I have tried the following, where I list the sheet names as follows:
    If Sh.Name = "DataBase" Or "List" Then
    But this gives me a Run-time error: 13 Type mismatch.

    When a list a single sheet name as follows:
    If Sh.Name = "DataBase" Then
    it works fine.

    Here is my code:

    Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    
    If Sh.Name <> "DataBase" Then
    
        MsgBox "You may use this sheet!"
       
    Else
    
        If Sh.Name = "DataBase" Or "List" Then
        answer = MsgBox("Please use with caution!", vbOKCancel)
            If answer = vbCancel Then
            
            Sh.Visible = False
                    
            End If
    
        End If
    
    End If
    
    End Sub
    Thank you!
    Last edited by onmyway; 03-01-2015 at 05:44 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 01-07-2015, 07:15 PM
  2. List of names in one sheet corresponding to multiple sheets
    By jones.mattew in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-12-2013, 08:34 AM
  3. [SOLVED] Simple macro to create list of sheet names and the contents of cells A1 & N1 of each sheet
    By atcsmh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-15-2013, 11:11 AM
  4. Copy cells from multiple worksheets into one list with Sheet names.
    By ksamarin88 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-11-2012, 04:45 PM
  5. Error 2465 on Simple Format Event
    By Strife in forum Access Programming / VBA / Macros
    Replies: 1
    Last Post: 03-13-2012, 12:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1