+ Reply to Thread
Results 1 to 14 of 14

Disable "Select Sheet"

Hybrid View

  1. #1
    Registered User
    Join Date
    07-18-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    88

    Disable "Select Sheet"

    Hi,

    I have a find and replace VBA formula which, when it cannot locate the specified sheet for that week, prompts the Select Sheet to popup. Is there a way for me to disable the Select Sheet popup?

    Code is below:

    Sub FindReplace()
    Range("Warehouse_1,ST_1,STP_1,Channel_1,Year_1").Select
        Selection.Replace What:=Range("Old_Week"), Replacement:=Range("New_Week"), LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
    Calculate
    End Sub

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Disable "Select Sheet"

    you can set displayalerts to false, I think that would work:
    Sub FindReplace()
    application.displayalerts = false
    Range("Warehouse_1,ST_1,STP_1,Channel_1,Year_1").Replace What:=Range("Old_Week"), Replacement:=Range("New_Week"), LookAt:=xlPart, _ SearchOrder :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
    Calculate
    application.displayalerts = true
    End Sub

  3. #3
    Registered User
    Join Date
    07-18-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Disable "Select Sheet"

    Quote Originally Posted by yudlugar View Post
    you can set displayalerts to false, I think that would work:
    Sub FindReplace()
    application.displayalerts = false
    Range("Warehouse_1,ST_1,STP_1,Channel_1,Year_1").Replace What:=Range("Old_Week"), Replacement:=Range("New_Week"), LookAt:=xlPart, _ SearchOrder :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
    Calculate
    application.displayalerts = true
    End Sub
    That didn't seem to work

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Disable "Select Sheet"

    I think I forgot to remove the underscore.
    Sub FindReplace()
    application.displayalerts = false
    Range("Warehouse_1,ST_1,STP_1,Channel_1,Year_1").Replace What:=Range("Old_Week"), Replacement:=Range("New_Week"), LookAt:=xlPart, SearchOrder :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
    Calculate
    application.displayalerts = true
    End Sub

  5. #5
    Registered User
    Join Date
    07-18-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Disable "Select Sheet"

    Hi Yudlugar,

    This solution still didn't work. It keeps on displaying the Select Sheet dialogue box when it can't find the tab

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Disable "Select Sheet"

    Sorry, I don't know then. This method works ok for me. For example, in a new workbook, this macro:
    Sub macro_1()
    Range("A1").Formula = "='NOTFOUNDSHEETNAME'!a1"
    End Sub
    displays sheet select dialog box and this macro
    Sub macro_1()
    Application.DisplayAlerts = False
    Range("A1").Formula = "='NOTFOUNDSHEETNAME'!a1"
    Application.DisplayAlerts = True
    End Sub
    does not.

  7. #7
    Registered User
    Join Date
    07-18-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Disable "Select Sheet"

    I even tried placing it just around the Channel_1 range and that still had no effect. It seems to find and replace fine until it gets to that cell and then anything beneath that in the named range doesn't get replaced.

  8. #8
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Disable "Select Sheet"

    Can you upload a workbook please and I'll take a look.

  9. #9
    Registered User
    Join Date
    07-18-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Disable "Select Sheet"

    I can't upload this workbook and it'll be quite hard to replicate with data as it's linking to specific file locations

  10. #10
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Disable "Select Sheet"

    Why can't you upload it?

    Just make a workbook that creates the error. It does not need to contain any real data.

  11. #11
    Registered User
    Join Date
    07-18-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Disable "Select Sheet"

    Quote Originally Posted by yudlugar View Post
    Why can't you upload it?

    Just make a workbook that creates the error. It does not need to contain any real data.
    Because it's a problem when it can't find the sheet in the workbook, not that it can't find the workbook. If I upload it with the links I have or any other links then when you open it, it'll bring a box up for you to open the file, not find the sheet.

  12. #12
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Disable "Select Sheet"

    So upload a workbook, where it can't find the sheet in a workbook and gives you the dialogue box, even with displayalerts set to false.

    When I replicate what you have done, I do not get the dialogue box, the solution I suggested works fine - did you try what I mentioned in post #6? Do you still get the dialogue bo x then?

  13. #13
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Disable "Select Sheet"

    Hi M1234

    Try this
    Option Explicit
    
    Sub FindReplace()
        On Error Resume Next
        Range("Warehouse_1,ST_1,STP_1,Channel_1,Year_1").Select
        Selection.Replace What:=Range("Old_Week"), Replacement:=Range("New_Week"), LookAt:=xlPart, SearchOrder _
                :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
        Calculate
        On Error GoTo 0
    End Sub
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  14. #14
    Registered User
    Join Date
    07-18-2013
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    88

    Re: Disable "Select Sheet"

    Quote Originally Posted by jaslake View Post
    Hi M1234

    Try this
    Option Explicit
    
    Sub FindReplace()
        On Error Resume Next
        Range("Warehouse_1,ST_1,STP_1,Channel_1,Year_1").Select
        Selection.Replace What:=Range("Old_Week"), Replacement:=Range("New_Week"), LookAt:=xlPart, SearchOrder _
                :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
        Calculate
        On Error GoTo 0
    End Sub
    No luck unfortunately it still asks me to select the sheet I'm referencing

+ 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. Disable pop-up "The cells you are trying to select are protected"
    By Alexander_Golinsky in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2013, 09:26 AM
  2. Disable "Select Multiple Items" in a Pivot Filter
    By FixandFoxi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-09-2013, 06:19 AM
  3. Posted on another forum >> Disable "Select Sheet" Dialog box
    By gtorres in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-06-2007, 02:43 PM
  4. Questionnaire sheet: Select "yes" or "no," and only one can be selected
    By bpatterson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-13-2006, 06:10 PM
  5. Disable "Select Multiple Items" in Pivot Table
    By Pasha in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-12-2005, 08:05 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