+ Reply to Thread
Results 1 to 4 of 4

Name warning when copying template

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-21-2004
    Location
    Norwich, CT USA
    MS-Off Ver
    Excel 2010
    Posts
    163

    Name warning when copying template

    I create a worksheet from a template, the target sheet has named ranges on it to provide input to a summary row.
    The summary row on the template has the names in the formulas even though they don't function on the template.
    When the summary rows are copied and pasted to the target worksheet I get the warning:
    "A formula or sheet you want to move or copy contains the name "...", which already exists on the destination worksheet."
    I can hit "ok" at each prompt which is fine for me but I don't want the user to have to even think about it.

    Is there a way I can cause this to be ignored or have "OK" be an automatic answer?
    a better work around?

    In case it helps, code:
    Public Sub InsSumRows()
    'Insert Summary Footer
        Dim mySpace As Range
        
        
        Worksheets("FA_Template").Range("faTempSumRows").SpecialCells(xlCellTypeVisible).Copy
    
        Range("a1").End(xlDown).Offset(2, 0).Select
    
        Set mySpace = Selection
    
        With Selection
            .PasteSpecial Paste:=xlPasteFormulas, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=False
            .PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
            SkipBlanks:=False, Transpose:=False
        End With
    
    End Sub
    thanks
    Robert

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Name warning when copying template

    Try putting this at the beginning of your code:

    Application.DisplayAlerts = False
    Set it back to True at the end.

    like this

    Public Sub InsSumRows()
    'Insert Summary Footer
    Application.DisplayAlerts = FALSE
    
        Dim mySpace As Range
        
        
        Worksheets("FA_Template").Range("faTempSumRows").SpecialCells(xlCellTypeVisible).Copy
    
        Range("a1").End(xlDown).Offset(2, 0).Select
    
        Set mySpace = Selection
    
        With Selection
            .PasteSpecial Paste:=xlPasteFormulas, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=False
            .PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
            SkipBlanks:=False, Transpose:=False
        End With
    
    Application.DisplayAlerts = TRUE
    End Sub
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Forum Contributor
    Join Date
    03-21-2004
    Location
    Norwich, CT USA
    MS-Off Ver
    Excel 2010
    Posts
    163

    Re: Name warning when copying template

    Perfect D!
    Thanks
    Robert

    Quote Originally Posted by DGagnon View Post
    Try putting this at the beginning of your code:

    Application.DisplayAlerts = False
    Set it back to True at the end.

    like this

    Public Sub InsSumRows()
    'Insert Summary Footer
    Application.DisplayAlerts = FALSE
    
        Dim mySpace As Range
        
        
        Worksheets("FA_Template").Range("faTempSumRows").SpecialCells(xlCellTypeVisible).Copy
    
        Range("a1").End(xlDown).Offset(2, 0).Select
    
        Set mySpace = Selection
    
        With Selection
            .PasteSpecial Paste:=xlPasteFormulas, Operation:= _
            xlNone, SkipBlanks:=False, Transpose:=False
            .PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
            SkipBlanks:=False, Transpose:=False
        End With
    
    Application.DisplayAlerts = TRUE
    End Sub

  4. #4
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Name warning when copying template

    Anytime!

    glad i could assist.

+ 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