+ Reply to Thread
Results 1 to 6 of 6

Worksheet does not become the active 1 using .Activate function based on MsgBox response

  1. #1
    Registered User
    Join Date
    03-27-2013
    Location
    Long Island, NY
    MS-Off Ver
    Excel 2007
    Posts
    35

    Worksheet does not become the active 1 using .Activate function based on MsgBox response

    I do not see what is going wrong here.
    Before the user runs the macro, they are supposed to use the autofilter on the "Project" tab to determine which #'s they would like to sort the data by.
    I have put a message box in, in case the user forgot to do that.
    If they select "No", exit the sub and have the active sheet be the "Project" tab.
    If "Yes" just run the macro(which works).

    I cannot get the "Project" tab to be the sheet shown if "No" is clicked.
    Any advice?

    *edit: it always goes to the "SC" tab instead
    Below is my macro:

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    01-02-2007
    Location
    Australia NSW
    MS-Off Ver
    2013
    Posts
    494

    Re: Worksheet does not become the active 1 using .Activate function based on MsgBox respon

    If the tab 'Project' is hidden, then you need to add:
    Please Login or Register  to view this content.
    before Activating it.

  3. #3
    Registered User
    Join Date
    03-27-2013
    Location
    Long Island, NY
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Worksheet does not become the active 1 using .Activate function based on MsgBox respon

    It is not hidden.

  4. #4
    Forum Contributor
    Join Date
    01-03-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: Worksheet does not become the active 1 using .Activate function based on MsgBox respon

    I would say it's because Response is declared as Boolean and thus can only have two values: True or False, so it won't accept vbNo. Change Response variable to be as String and it should work. But this is only my opinion

  5. #5
    Registered User
    Join Date
    03-27-2013
    Location
    Long Island, NY
    MS-Off Ver
    Excel 2007
    Posts
    35

    Re: Worksheet does not become the active 1 using .Activate function based on MsgBox respon

    Sbarro79, thank you very much! works like a charm

  6. #6
    Forum Contributor
    Join Date
    01-02-2007
    Location
    Australia NSW
    MS-Off Ver
    2013
    Posts
    494

    Re: Worksheet does not become the active 1 using .Activate function based on MsgBox respon

    Also, Change:
    Please Login or Register  to view this content.
    to:
    Please Login or Register  to view this content.
    Some words do not work effectively when declared, and try Variant instead of Boolean.

+ 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. [SOLVED] Msgbox with if condition based on date of worksheet
    By nickmax1 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 04-30-2013, 05:48 AM
  2. Replies: 1
    Last Post: 12-03-2012, 08:55 AM
  3. Stop Input into Worksheet Based on Yes No Response
    By fmluder93 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-09-2009, 03:38 AM
  4. [SOLVED] Activate a Worksheet from a Custom Function ??
    By monir in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-17-2005, 02:06 PM
  5. MsgBox response
    By Sunflower_Queen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2005, 05:08 PM

Tags for this Thread

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