+ Reply to Thread
Results 1 to 13 of 13

Excel copies named range from a different sheet when a sheet is copied

  1. #1
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Excel copies named range from a different sheet when a sheet is copied

    This looks like an amazing Excel bug to me.
    When I copy the sheet that says copy me it also creates a copy of a named range from the other sheet.
    That wouldn't be so bad but I get a warning message as well.

    Can you guys recreate this bug?

    Or is it maybe a feature that I don't understand, that is quite possible.

    This is actually a rather large application that is being used by many people in my company everyday, I just cut it down to bare minimum.
    Attached Files Attached Files
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Excel copies named range from a different sheet when a sheet is copied

    Hi there,


    Can you guys recreate this bug?

    I've experienced this "phenomenon" in the past and, as far as I can tell, it occurs when the Named Ranges are defined at workbook level - it doesn't seem to occur when they are defined at worksheet level.

    Hope this helps.

    Regards,

    Greg M
    Last edited by Greg M; 06-03-2023 at 08:44 AM. Reason: Typo corrected

  3. #3
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Excel copies named range from a different sheet when a sheet is copied

    Thanks Greg, I'll try that. I'm taking some time off now but I'll try remember posting some feedback once I get back to it.

    Just for peace of mind, this is a bug right? It's not something I'm misunderstanding?

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: Excel copies named range from a different sheet when a sheet is copied

    I think it's intended behaviour, for the reason Greg has mentioned: if you have a named range whose level is set at workBOOK, then I think it entirely reasonable that Excel would assume you'd want that range on a clone of that sheet (because its scope is workbook). If the scope is workSHEET, then I think it reasonable for Excel to assume that you would not want it cloning if you copy the worksheet.

    At least, that's my take on it. Not unexpected behaviour in my eyes.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Excel copies named range from a different sheet when a sheet is copied

    A little bit late but here is some extra noise to this story:
    Sometimes it just creates a copy of the named range, sometimes it creates a copy AND throws a warning that the named range already exists.
    Sometimes it seems to overwrite that new name definition every time you copy, so only one extra named range definition no matter how many times you copy.
    Sometimes it creates a new definition and keeps the old one every time you copy. My application is based on copying sheets so I'm left with a ton of extra named ranges, each defined on a new sheet but still referring to the original named range which is on another sheet.

    Why does Excel even have this feature of defining a variable on one sheet that is local to another sheet???

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: Excel copies named range from a different sheet when a sheet is copied

    Sometimes it creates a new definition and keeps the old one every time you copy.
    This is a contradiction in terms!

    I haven't experienced anything I'd consider illogical in this respect, but I use named ranges sparingly and carefully. I haven't looked at your particular workbook.

  7. #7
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Excel copies named range from a different sheet when a sheet is copied

    See if you can recreate it. All you have to do is open my workbook, look at named ranges, drag-copy the worksheet by holding ctrl and then look at the named ranges again.

  8. #8
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Excel copies named range from a different sheet when a sheet is copied

    Quote Originally Posted by AliGW View Post
    I think it's intended behaviour, for the reason Greg has mentioned: if you have a named range whose level is set at workBOOK, then I think it entirely reasonable that Excel would assume you'd want that range on a clone of that sheet (because its scope is workbook). If the scope is workSHEET, then I think it reasonable for Excel to assume that you would not want it cloning if you copy the worksheet.

    At least, that's my take on it. Not unexpected behaviour in my eyes.
    That's kind of brave posting that without having opened and tried it on my workbook. The named range appears local on the new sheet but refers to the original sheet. Is that really intentional?

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: Excel copies named range from a different sheet when a sheet is copied

    I've tried several times, both with content enabled and content not enabled, and I cannot reproduce this. However, as you have direct access to the source of the query that feeds the table, I think that might have something to do with it. When it happens for you, I presume it's also duplicating the query - is it?

    That's kind of brave posting that without having opened and tried it on my workbook.
    How so? I have worked with many workbooks that contain named ranges in my time - I think that qualifies me to comment. You didn't make a similar comment to Greg, and his comments were based on his own experience, as were mine. In any case, I said "I think ..."
    Last edited by AliGW; 06-04-2023 at 05:33 AM.

  10. #10
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Excel copies named range from a different sheet when a sheet is copied

    Hi again,

    Many thanks for your feedback and also for the Reputation increase - much appreciated!

    You're welcome - hope you found my comments useful.

    Best regards,

    Greg M

  11. #11
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Excel copies named range from a different sheet when a sheet is copied

    I tried to inserts pictures but they only show up as attachments? How do I make them pictures in the post and not attachments?

    Anyway, I deleted the queries, forgot to do that before. It made no difference.

    This is what I see on my computer. Is this intended behavior AliGW ?
    Attachment 831873
    Attachment 831875

  12. #12
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Excel copies named range from a different sheet when a sheet is copied

    How do I post a picture of this in a post?

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,418

    Re: Excel copies named range from a different sheet when a sheet is copied

    Those attachments aren’t valid so I can’t see them. Attach the images as you would attach a workbook.

+ 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: 4
    Last Post: 03-22-2023, 07:12 PM
  2. Copy Named Range values from one sheet to another in excel using VBA
    By BMD4 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-26-2020, 12:42 AM
  3. VBA to create multiple copies of a sheet, copies named based on list in other sheet
    By Parth007 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-27-2019, 02:40 AM
  4. Replies: 0
    Last Post: 06-16-2016, 07:52 AM
  5. Macro that copies sheet and places after the copied sheet every time
    By goatie43 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-08-2015, 10:27 AM
  6. excel macro range define to another sheet / named range
    By koi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-21-2013, 10:25 AM
  7. Replies: 3
    Last Post: 11-21-2011, 05:42 AM

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