Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 819427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:18:26+00:00 2026-05-15T02:18:26+00:00

I am trying to capture worksheets being copied in to a workbook from another

  • 0

I am trying to capture worksheets being copied in to a workbook from another workbook.
Workbook_NewSheet event does not trigger when the sheets are copied from another workbook.
It is triggered only if the user manually inserts them through (Insert->Worksheet menu option), or when you add a new sheet through VBA as ThisWorkbook.Worksheets.Add.

What I am trying to capture is basically a Paste operation which is resulting in a new sheet.

This might be from any of the below user actions:

  1. User copies an existing sheet by dragging it holding Control Key (which adds a new sheet)
  2. User copies sheet/s from another workbook
  3. user moved sheets from another workbook

or any of the below VBA code:

SourceWorkbook.Sheets(“SourceSheet”).Copy Before:=TargetWorkbook.worksheets(“SheetNameIn Target”) 'copy across workbook'  
SourceWorkbook.Sheets(“SourceSheet”).Move Before:=TargetWorkbook.worksheets(“SheetNameIn Target”) 'move across workbook'  
ThisWorkbook. Sheets(“SheetName”).Copy 'copy within workbook'  

If you know any way of capturing this action/macro results within VBA that would be greatly helpful.

Please note that I do not want to avoid such an user action (so i do not want to secure the workbook) but I want to handle the pasted sheet programatically to verify the data, and if the similar sheet already exists then update the existing sheet rather than having same data in two sheets.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T02:18:27+00:00Added an answer on May 15, 2026 at 2:18 am

    The way I have it implimented is

    Private Sub Workbook_WindowActivate(ByVal Wn As Window)
    ToggleMenuOptions False, 848, 889
    End Sub
    
    Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
    ToggleMenuOptions True, 847, 848, 889
    End Sub
    
    Public Function ToggleMenuOptions(bToggle As Boolean, ParamArray ControlID() As Variant) As Boolean
    '848 Move or Copy Sheet...
    '889 Rename Sheet
    '847 Delete Sheet
    On Error GoTo lblError
    Dim oControl As CommandBarControl, oControls As CommandBarControls, iControl As Integer
    If IsMissing(ControlID) Then
        ToggleMenuOptions = False
        Exit Function
    End If
    
    For iControl = LBound(ControlID) To UBound(ControlID)
        For Each oControl In Application.CommandBars.FindControls(ID:=ControlID(iControl))
            oControl.Enabled = bToggle
        Next
    Next
    ToggleMenuOptions = True
    Exit Function
    lblError:
        If Err.Number Then
            ToggleMenuOptions = False
            Exit Function
        End If
    End Function
    
    Private Sub Workbook_NewSheet(ByVal Sh As Object)
    MsgBox "Please use Add New Project option in custom Toolbar to add new sheets!!", vbExclamation, "Not Supported"
    Application.DisplayAlerts = False
    Sh.Delete
    Application.DisplayAlerts = True
    End Sub
    

    So my users wont be able to rename, add or delete sheets. This is working pretty well for now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem: I am trying to capture click event of the ImageButton. I am not
I'm trying to capture the ENTER event of a TextInput like so: a_txt.addEventListener(fl.events.ComponentEvent.ENTER, aEnter);
I am trying to capture urls in an html page that is being repeated
I'm trying to capture packets from two devices on my network. I have tcpdump
I have been trying to capture stdout and stderr output from a DLL compiled
I am trying to capture video from a camera. i have gotten the captureOutput:didOutputSampleBuffer:
I am trying to capture the output from tail in follow mode, where it
I'm trying to capture aa,bb,cc from the following strings: ,aa,bb,cc, aa,bb,cc, ,aa,bb,cc aa,bb,cc My
WebDriver->I am trying to capture the 'date' selected from a UI-Calender. I want to
I'm trying to capture an image from the window mobile device using Qt. Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.