Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Apr 2007
    Location
    Lancashire, United Kingdom
    Posts
    264
    Thanks
    32
    Thanked 5 Times in 5 Posts

    How can I stop my macro from asking to copy a name that already exists?

    I am copying tabs from two spreadsheets to one new one (two tabs - old data and new data).

    But each tab in the original spreadsheets have named ranges - the same names. So, the second copy always stops and asks me if I want to overwrite the existing name (from the first copy). And there are 100's of them.

    How can I get it to default to "Yes"?

    I tried adding an "On error resume next", but I guess it's not an error!!

    Any help appreciated (as always)

    Alan

  2. #2
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,639
    Thanks
    115
    Thanked 651 Times in 593 Posts
    try Application.DisplayAlerts = False

    Don't forget to turn it back on at the end of the macro

    HTH,
    Maud

  3. The Following User Says Thank You to Maudibe For This Useful Post:

    alan sh (2014-04-04)

  4. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts
    Try adding this before the line:
    Application.DisplayAlerts=False

    And reset it afterwards with:
    Application.DisplayAlerts=True

    Steve

  5. The Following User Says Thank You to sdckapr For This Useful Post:

    alan sh (2014-04-04)

  6. #4
    3 Star Lounger
    Join Date
    Apr 2007
    Location
    Lancashire, United Kingdom
    Posts
    264
    Thanks
    32
    Thanked 5 Times in 5 Posts
    Oh you two are stars. That fixed it!

    Alan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •