Forum Discussion

TTsak's avatar
TTsak
Copper Contributor
Apr 24, 2024

Copy Tab in worksheet to new worksheet

I have copied a tab from one worksheet to another and when I update the Tab from the first worksheet it doesn’t automatically update in the second worksheet in which I’ve copied that tab to. What am I doing wrong? We are making sure that the tabs are updated through the Excel Desktop app and not through the website link

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    TTsak 

    When you copy a tab from one worksheet to another in Excel, you are essentially creating a static copy of the original tab. Changes made to the original tab will not automatically reflect in the copied tab unless you use a dynamic method to link the two tabs together.

    To create a dynamic link between the two tabs, you can use formulas or VBA (Visual Basic for Applications). Here are two approaches you can consider:

    1. Formulas: You can use formulas to reference cells or ranges from the original tab to the copied tab. For example, if you want to copy the entire tab, you can use formulas like ='OriginalTab'!A1 to link cell A1 from the original tab to the copied tab. This way, any changes made in the original tab will automatically update in the copied tab.
    2. VBA: You can use VBA to create a more robust solution that automatically updates the copied tab whenever changes are made to the original tab. Here's a basic example of VBA code that does this:

    VBA code is untested, please backup your file first.

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim originalSheet As Worksheet
        Dim copiedSheet As Worksheet
        Dim rng As Range
        
        ' Set the original and copied worksheets
        Set originalSheet = ThisWorkbook.Worksheets("OriginalTab")
        Set copiedSheet = ThisWorkbook.Worksheets("CopiedTab")
        
        ' Define the range to be copied
        Set rng = originalSheet.Range("A1:Z100")  ' Adjust the range as needed
        
        ' Copy the range from the original sheet to the copied sheet
        rng.Copy copiedSheet.Range("A1")
    End Sub

    This VBA code should be placed in the module for the worksheet where you want the copied tab to be updated. It creates an event handler that triggers whenever a change is made in the original tab. When triggered, it copies the specified range from the original tab to the corresponding range in the copied tab.

    Choose the approach that best fits your requirements and implement it accordingly in your Excel workbook. The text was created with the help of AI.

     

    Hope this will help you.

     

    Was the answer useful? Mark as best response and like it!

    This will help all forum participants.

Resources