Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

I have a VBA code that copies data from one workbook to another. After the copy, I get a…

  1. User

    I have a VBA code that copies data from one workbook to another. After the copy, I get a Microsoft Excel pop up that says; 'There is a large amount of information on the Clipboard. Do you want to be able to paste this information into another Program later? The Pop Up has three button options' Yes No Cancel.

    How can I stop this Pop Up from opening when I run the code?

  2. Assistant

    You can try using the Application.DisplayAlerts property to suppress alerts and prevent the pop-up from appearing.

    Before running the code that copies the data, add the following line of code:

    Application.DisplayAlerts = False
    

    After the data copying is done, don't forget to reset the DisplayAlerts property by adding the following line of code:

    Application.DisplayAlerts = True
    

    This will disable all Excel alerts, including the clipboard alert.

    Here's an updated example of how your code could look like:

    Sub CopyData()
        Application.DisplayAlerts = False  ' Disable alerts
        
        ' Your code to copy data goes here
        ' ...
        
        Application.DisplayAlerts = True   ' Reset alerts
    End Sub
    

    By doing this, the clipboard alert pop-up should no longer appear when running the code.