Workbook Open not working

ExcelRoy

Well-known Member
Joined
Oct 2, 2006
Messages
2,540
Office Version
  1. 365
Platform
  1. Windows
Hi all,

seem to be having a little problem with the following not working

Code:
Private Sub Workbook_Open()

Call Clear_Rep_Backorders
Call Clear_Ref_Backorders
Call Clear_Wa_Backorders
Call Clear_board
Call Clear_Q_Backorders
Call Delete_Names

End Sub
An ideas why this may be happening

Many thanks
 
Last edited:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Are Macros/VBA enabled?

An easy way to verify is to add this line:
Code:
Private Sub Workbook_Open()

[COLOR=#ff0000]MsgBox "Running Workbook_Open code"[/COLOR]

Call Clear_Rep_Backorders
Call Clear_Ref_Backorders
Call Clear_Wa_Backorders
Call Clear_board
Call Clear_Q_Backorders
Call Delete_Names

End Sub
If you get the message box, then you know that the code is enabled and running. So then I would suspect an issue with the code you are calling.
 
Upvote 0
Hi Joe4,

thanks, no message popped

here is the code I am calling

Code:
Sub Clear_Rep_Backorders()
    Sheets("Update").Select
    Range("C3:S502").Select
    Selection.ClearContents
    Range("A1").Select
End Sub

Sub Clear_Ref_Backorders()
    Sheets("Update").Select
    Range("AC3:AS502").Select
    Selection.ClearContents
    Range("A1").Select
End Sub

Sub Clear_Wa_Backorders()
    Sheets("Update").Select
    Range("BC3:BS502").Select
    Selection.ClearContents
    Range("A1").Select
End Sub

Sub Clear_board()
    Sheets("Update").Select
    Range("CC3:CW10002").Select
    Selection.ClearContents
    Range("A1").Select
End Sub

Sub Clear_Q_Backorders()
    Sheets("Update").Select
    Range("DE3:EC502").Select
    Selection.ClearContents
    Range("A1").Select
End Sub

Thanks
 
Last edited:
Upvote 0
thanks, no message popped
That means that either you are not allowing VBA/Macros to run, or you have disabled events.

Try closing out of Excel and re-opening it and try again. If you still do not get the MsgBox, check your Excel security settings to see what they are set to.
 
Last edited:
Upvote 0
Hi Joe4,

tried re-opening several times, checked macros enabled, checked each line of code and works when run

just strange why this wont work when opened up from scratch

Thanks
 
Upvote 0
Is the Private Sub Workbook_Open() code in the ThisWorkbook module?
 
Upvote 0
It needs to be in the ThisWorkbook module.
That's why it's not working.
 
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,014
Messages
6,122,697
Members
449,092
Latest member
snoom82

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