Results 1 to 12 of 12

VBA Worksheet Tab Rename Macro Causing Excel Infinite Loop

Threaded View

  1. #1
    Registered User
    Join Date
    04-14-2011
    Location
    Bay Area, CA
    MS-Off Ver
    Excel 2007
    Posts
    32

    VBA Worksheet Tab Rename Macro Causing Excel Infinite Loop

    Howdy,

    So, I found the following "Worksheet Tab Rename " macro code posted on MrExel by member VOG, in the following thread:

    http://www.mrexcel.com/forum/excel-q...s-formula.html

    Private Sub Worksheet_Calculate()
    On Error Resume Next
    Me.Name = Range("A1").Value
    On Error GoTo 0
    End Sub
    Nobody over there seems to be able to replicate my issue or determine what is causing my issue, so I thought that I should post here in the hopes that, since I can actually attach my spreadsheet here, folks could open it & replicate my issue.

    The macro code works perfectly, except when I make a copy of the Worksheet (by right-clicking the Tab & selecting "move or copy") and then paste it in the workbook, it starts an infinite loop which I must kill Excel in order to get out of.

    I know it's the macro code that is the issue, or that is triggering the issue, because when I have the code commented out, I can make a copy of the Worksheet.

    My "A1" in the code is "S47" in my sheet, and it is calculated from a formula. Also, the cell & formula get updated when a user selects a choice from a drop-down list in a different cell. I want the user to select the choice from the drop-down list, and then that choice gets used as the name for the tab.

    If he copies the sheet, he will then select another (different) choice from the drop-down list on that sheet. Each sheet that he copies must have a different choice selected, so at no time will there be more than 1 sheet with the same choice selected (except of course on the initial "copy & paste" of the tab, which I think is causing the infinite loop).

    If anyone can chime in w/ a solution, as well as how to troubleshoot / debug this, any & all help would be much appreciated.

    Thanks,
    Rob
    Excel 2007
    Windows 7
    Attached Files Attached Files
    Last edited by rbrookov; 05-07-2014 at 03:42 PM. Reason: Added code tags as per forum rules

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. BeforeRightClick causing infinite loop and slow calculation
    By k64 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-28-2013, 07:18 PM
  2. Excel 2007 - Print Macro - Infinite Loop Issue
    By Fraenk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2012, 07:50 AM
  3. worksheet rename using location causing error
    By wejones in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-06-2011, 08:46 PM
  4. Macro goes into an infinite loop
    By excelforum123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-21-2010, 10:08 AM
  5. [SOLVED] worksheet change infinite loop/calculate for user functions
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2006, 12:30 AM

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