Forum Discussion

Excelkid's avatar
Excelkid
Copper Contributor
Aug 07, 2025

Add a copy tab function, but remove all the formulas

Hi, I’m familiar with how to copy a tab and then use "Paste Values" to remove all the formulas. However, would it be possible for you and your team to create a feature or shortcut that automatically copies a tab with values only? It would help streamline the process and save time.

2 Replies

  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    As variant with Office Scripts

    function main(workbook: ExcelScript.Workbook) {
    
        const fromSheet = "Source sheet"
        const toSheet   = "Target sheet"
    
        const source = workbook.getWorksheet(fromSheet).getUsedRange()
        const address = source.getAddress()
    
        workbook.getWorksheet(toSheet)
            .getRange(address.slice(address.indexOf("!") + 1))
            .copyFrom(source, ExcelScript.RangeCopyType.values)
    }
  • In the desktop version of Excel on Windows/Mac, you can use a macro for this purpose:

    Sub CopySheetValues()
        Dim ws As Worksheet
        Dim wt As Worksheet
        On Error GoTo ErrHandler
        Application.ScreenUpdating = False
        Set ws = ActiveSheet
        ws.Copy After:=ws
        Set wt = ws.Next
        With wt.UsedRange
            .Value = .Value
        End With
    ExitHandler:
        Application.ScreenUpdating = True
        Exit Sub
    ErrHandler:
        MsgBox Err.Description, vbExclamation
        Resume ExitHandler
    End Sub

    If you create this macro in your personal macro workbook (see here for more info), you can call it anywhere. For ease of use, you can create a keyboard shortcut and/or a Quick Access Toolbar button for the macro.

Resources