Excel crash just after opening

KadeFoster

New Member
Joined
Jan 1, 2017
Messages
8
hey all,

I am trying to work out what is killing my workbook.

I open the workbook and not even a second after opening excel just shuts down. I think it has to do with my VBA in thats in ThisWorkBook >> Open Workbook Sub

It doesn't happen all the time and i cannot replicate what i was doing. I have opened and closed the workbook like 100 times and nothing, then it just happens and the workbook is broken.

Below is my code. All recommendations welcome.

VBA Code:
Private Sub Workbook_Open()
    
    If Range("BOOKCOUNTER").Value = 0 Then
        Range("DowntimeToyota") = 0
        Range("DowntimeForklift") = 0
        Range("DowntimeBobcat") = 0
        Range("RedirectedForklift") = 0
        Range("BOOKCOUNTER").Value = Range("BOOKCOUNTER").Value + 1

    Else: Range("BOOKCOUNTER").Value = Range("BOOKCOUNTER").Value + 1

    End If
    
End Sub
 

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.
I recently experienced strange and random issues with workbooks shutting down and at first began recreating them thinking they may be corrupted but the same issues occurred again. I found my solution was to change the virtual (pagefile) memory size. If you Google that you will find many sites to advise but here are two which are almost duplicates:

It may not be your solution but maybe worth a check to save ineffective effort. It's possibly trial and error time by the sounds of it.

HTH
 
Upvote 0
I recently experienced strange and random issues with workbooks shutting down and at first began recreating them thinking they may be corrupted but the same issues occurred again. I found my solution was to change the virtual (pagefile) memory size. If you Google that you will find many sites to advise but here are two which are almost duplicates:

It may not be your solution but maybe worth a check to save ineffective effort. It's possibly trial and error time by the sounds of it.

HTH
Not sure if this is something i can do on my work computer.
 
Upvote 0
Hi KadeFoster. Is this a file stored on One Drive? There have been posts about syncing issues and wb's crashing due to wb open code. The solution was to...
VBA Code:
Private Sub Workbook_Open()
    If ThisWorkbook.Sheets("Sheet1").Range("BOOKCOUNTER").Value = 0 Then
       ThisWorkbook.Sheets("Sheet1").Range("DowntimeToyota") = 0
       ThisWorkbook.Sheets("Sheet1").Range("DowntimeForklift") = 0
       ThisWorkbook.Sheets("Sheet1").Range("DowntimeBobcat") = 0
       ThisWorkbook.Sheets("Sheet1").Range("RedirectedForklift") = 0
       ThisWorkbook.Sheets("Sheet1").Range("BOOKCOUNTER").Value = _
                         ThisWorkbook.Sheets("Sheet1").Range("BOOKCOUNTER").Value + 1
    Else: ThisWorkbook.Sheets("Sheet1").Range("BOOKCOUNTER").Value = _
                         ThisWorkbook.Sheets("Sheet1").Range("BOOKCOUNTER").Value + 1
    End If
End Sub
You will need to adjust the sheet name to suit. There was also some mention of adding some wait code to the open event so as to give One Drive time to do it's thing. HTH. Dave
ps. Here's a link with some similar info.
 
Upvote 0
OK thanks i will give this a go and see what happens. Will used it for a few days over my block and see if it crashes.

I was also thinking of moving the code to the sheet activate sub. So opening isn't affected.
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,825
Members
449,190
Latest member
rscraig11

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