Forum Discussion

erictengo's avatar
erictengo
Copper Contributor
May 22, 2025

Prevent Text Box from being copied to a new sheet .

Is it possible to add a text box to a sheet that cannot be copied when that sheet is copied to a new tab? 

In other words - I have a workbook with several tabs. Tab 7 is intended to be a change order template that gets copied to a new tab for each subsequent change order.

I have a Text Box note on Tab 7 that contains step-by-step instructions to other users (some users are very computer illiterate) regarding how to copy the sheet and rename the copied tab (by right clicking tab 7, selecting "Move or Copy...", selecting "move to end" and checking the "Create a copy" box. 

I'd like the new tab to NOT contain the instructional text box. 
I've read several AI generated responses and tried all of them but none of them seem to work. One of them was recreating the text box as an "ActiveX Control Text Box". That was no help at all. I got the same result. 

I'm using Excel 365.

Thanks in advance for any help.

4 Replies

  • Riny_van_Eekelen's avatar
    Riny_van_Eekelen
    Platinum Contributor

    Tried to replicate what you described but failed. Perhaps because I added a text box as a rectangle shape since the form control textbox icon in the Developer ribbon is greyed out on my Excel (don't know why). File attached.

    I can copy the Sheet1 the way you describe (right-click, Move or Copy... etc., or add a sheet then select the entire Sheet1, copy and paste to the new sheet, or press right Alt key and drag sheet to the right and drop it.

    Neither of these options copies the shape with the instructions but data and formulas do. Give it try and let me know.

     

     

  • SnowMan55's avatar
    SnowMan55
    Bronze Contributor

    I suspect that what Kidd_lp intended was to use the SheetActivate event, so you don't have to wait for a cell to be changed:

    Private Sub Workbook_SheetActivate(ByVal Sh As Object)
        Dim txtBox As Shape
        If Sh.Name <> "Tab 7" Then '...or whatever the name of the template worksheet is
            For Each txtBox In Sh.Shapes
                If txtBox.Name = "TextBox1" Then    '...or whatever the nmae of the control is
                    txtBox.Delete
                End If
            Next txtBox
        End If
    End Sub

    Not much more information is available in Microsoft documentation.

    But I would be very concerned about sharing a macro-enabled workbook among employees.  Discuss the security concerns with your IT staff.

  • How about by using VBA:

     

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
        Dim txtBox As Shape
        For Each txtBox In Sh.Shapes
            If txtBox.Name = "InstructionTextBox" Then
                txtBox.Delete
            End If
        Next txtBox
    End Sub

     

    • sofiagonalez2005's avatar
      sofiagonalez2005
      Copper Contributor

      this is code to reslove your question :

      #include <stdio.h> #include<windows.h> int main() { cout<<"this demon " <<endl;//the key of quesi is :0x50dUfe8ajR3D6ADFDF696EFE72FD4946AC74E3544A46226F10DFACEE04A8F3E124081035467D1111DBCF95248A7D352BDF91F37DACD3FD35FD62elJXr53px== {

       

Resources