+ Reply to Thread
Results 1 to 5 of 5

Simple error: List multiple sheet names in Workbook_SheetActivate event

  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:
    Please Login or Register  to view this content.
    But this gives me a Run-time error: 13 Type mismatch.

    When a list a single sheet name as follows:
    Please Login or Register  to view this content.
    it works fine.

    Here is my code:

    Please Login or Register  to view this content.
    Thank you!
    Last edited by onmyway; 03-01-2015 at 05:44 AM.

  2. #2
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Simple error: List multiple sheet names in Workbook_SheetActivate event

    Try change the line to:
    Please Login or Register  to view this content.
    And here's another alternative:
    Please Login or Register  to view this content.
    You may want to wrap it in application.enableevents = False and application.enableevents = True, in case you'd hide the DataBase or List-sheets during the procedure by pressing cancel (thereby triggerering a new event).

    Hope this helps,
    berlan
    Last edited by berlan; 03-01-2015 at 05:25 AM.

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

    Re: Simple error: List multiple sheet names in Workbook_SheetActivate event

    hi berlan,

    Thank you for your help!

    I like you method:

    Please Login or Register  to view this content.
    BUT, all sheets listed in Case:

    Please Login or Register  to view this content.
    seems to also trigger Case Else?

    Any ideas?

  4. #4
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Simple error: List multiple sheet names in Workbook_SheetActivate event

    Oh, forgot to clarify:
    LCase$(Sh.Name), gives you the sheet name in lower case. So try write the sheets as such in Case:
    Please Login or Register  to view this content.
    Or alternatively change the line:
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Best,
    berlan

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

    Re: Simple error: List multiple sheet names in Workbook_SheetActivate event

    hi berlan,

    like a charm!

    thank you for not only the solution, but also the informative explanation. I learned something new today.

    Cheers!

+ Reply to Thread

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