+ Reply to Thread
Results 1 to 6 of 6

Defined Names 'Stuck'

  1. #1
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Post Defined Names 'Stuck'

    I seem to have got my defined names stuck and I don't know why / how.

    In my large mulitsheet workbook I have several cells & ranges that I have defined names for in the 'names' box, (usually top left), and also a couple of formulae that I have created using the 'Insert' --> 'Name' --> 'Define' route.

    So here is my issue.
    If I insert a newsheet into the workbook, then backup that sheet by copying it to another workbook it seems to take some of the define names with it.
    If I then delete the original sheet in the original workbook, and try to 'restore' it by copying the worksheet from the backup into the original workbook I get an error saying that names on the worksheet conflict with names already in the workbook

    Why is my worksheet carrying some of the defined names with it?
    How do I stop it carrying them?

    Thanks

    (If the above is too confusing I shall do my best to try and replicate the problem on a smaller workbook and upload it)
    If you find the response helpful please click the scales in the blue bar above and rate it
    If you don't like the response, don't bother with the scales, they are not for you

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: Defined Names 'Stuck'

    If you copy a sheet, then it will include any workbook-level defined names and any names defined as local to that sheet. When you copy it back, you should be asked which version of the names you want to use. If you copy just the cells to a new sheet in another workbook, then the only names that should be copied across are names that are actually used by those cells.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Defined Names 'Stuck'

    Thanks for that. The copying and the copying back is being done by a VBA macro which is then kicking up the warning about duplicate names, which I don't want.
    Seems like rather than copying the worksheet as a whole entity perhaps I will have to copy just the cells as you have said.

    If I copy all of the usedrange will that include column / row sizes, merged cells, conditional formating etc?

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: Defined Names 'Stuck'

    You won't get column widths by default, but you can pastespecial those. Alternatively, you coul djust use Application.DisplayAlerts = False when copying the sheet back - the default option in the name warning dialog is Yes so you would end up using the names in the workbook you are copying to.
    If you were lucky, you might lose the merged cells when copying...

  5. #5
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Defined Names 'Stuck'

    Hmmm... DisplayAlerts=False might serve my purposes here then, after all if the definitions came from the original workbook when the sheet was copied from their into the 'backup', then I can think of no issues of using the original workbooks's definitions when the sheet is 'restored' from the backup back into the original workbook...

    Thanks

  6. #6
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770

    Re: Defined Names 'Stuck'

    I've just tried doing it this way instead of copying the worksheet:

    Please Login or Register  to view this content.
    It seems to work
    Everything is copied over, merged cells, conditional formating, cell and text colouring, and yes, even column widths. The only thing i don't seem to have are the pesky defined names, which is great!

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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