Excel closes automatically

WxShady13

Board Regular
Joined
Jul 24, 2018
Messages
184
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I have a new desktop computer and since I started using it any Excel file with a macro will run the script and then just close Excel. There are no errors, nor does it matter which Excel workbook I use. These previously worked fine on a different computer, and other colleagues are able to use the files as they always have. Is there a setting on my new computer or do I need to run Office Repair?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
is there a personal workbook macro?
can you post an example of any code you are running?

The macro's are only used specifically for the workbooks and they are all different in each workbook. Each workbook that I have tried has unique macro's and the code is different.
 
Upvote 0
okay well no on can help you if you don't give more information

perhaps include: your version of excel/office, what version of windows you are using, if these are fresh installations or the computer came with them.
an example of a code you run that closes excel.
or perhaps you have a personal macro workbook you didn't know you had that has a sheet enabled vba code or similar function
you can check here on how to find it

or you can just run office repair :rolleyes: and pray that it solves your problem
 
Upvote 0
I am using Office 365 Excel

Here s an example of the first macro that is launched.

Code:
Sub CopyTable()
Application.ScreenUpdating = False
Sheets("SHMM Sections").Unprotect Password:="-----"
'Worksheets("SHMM Sections").Range("A3:CS200").ClearContents
With Worksheets("SHMM Sections").ListObjects("Table4")
        If Not .DataBodyRange Is Nothing Then
            .DataBodyRange.Delete
        End If
    End With

Dim LastRow As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Call CBTModuleClear
Worksheets("Sign-In Sheet").Range("A7:D" & LastRow).Copy
Worksheets("SHMM Sections").Range("A3:CS" & LastRow).PasteSpecial xlPasteValues
Worksheets("CBT Modules").Range("A2:D" & LastRow).PasteSpecial xlPasteValues
'Worksheets("SHMM Sections").Range("A3").PasteSpecial = xlPasteValues
Call IFStatements
Call CBTIfStatements
Sheets("SHMM Sections").Protect Password:="-------"
Application.ScreenUpdating = True
End Sub

Thiscode sta
 
Upvote 0
I am using Office 365 Excel

Here s an example of the first macro that is launched.

if this first macro exits excel then go through your macros
"CBTModuleClear, IFStatements, and CBTIfStatements
and check for the keywords using the ctrl + f find function
".Quit" , "Application", ".Close"

note that case sensisitvity and whole word only should be unchecked.
you can also check the "Current Project" search radio button

try also looking in your microsoft excel objects > ThisWorkbook as well as microsoft excel objects > Sheet(whichever one is relevant) in the Microsoft Visual Basic editor screen
any codes there?

also any update on if you have a macro workbook?
 
Last edited:
Upvote 0
It is saved as a macro workbook (.xlsm)

Thank you let me go check the code.
 
Upvote 0
I went through the workbook & macros and there is no code telling it to close. Also on all the other machines it does not close automatically.
 
Upvote 0
You still haven't answered BlakeSkate's question about whether or not you have a Personal Macro Workbook on your computer.
These macros would NOT be found in the workbook you are talking about, but would be available to you at all times when you have Excel open.
See: https://trumpexcel.com/person-macro-workbook/

The easiest way to see if you do is to close out of all open Excel workbooks, except for this one that you are working on.
Then, go into the VB Editor, and bring up the Project Explorer (View -> Project Explorer).
How many VBAProjects does it show? Does it list one named VBAProject (PERSONAL.XLSB)?
 
Upvote 0
the only thing i can think of BESIDES a personal macro workbook is if you have an an excel addin that is corrupt. You could try to uninstall and reinstalling any addons you have installed to this pc.
 
Upvote 0

Forum statistics

Threads
1,213,514
Messages
6,114,078
Members
448,547
Latest member
arndtea

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top