code help

d0wnt0wn

Well-known Member
Joined
Oct 28, 2002
Messages
771
currently i have this code that runs on workbook startup.... but is there any way that i can disable the code on the file that has been "saved as"??

Private Sub WORKBOOK_OPEN()
Dim i As Long
Application.ScreenUpdating = False
Sheets("flat estimates").Activate
Sheets("flat estimates").ComboBox1.Clear
Sheets("flat estimates").ComboBox1.AddItem "--Choose Estimate Type--"
For i = 1 To Sheets("flat estimates").Scenarios.Count
Sheets("flat estimates").ComboBox1.AddItem Sheets("flat estimates").Scenarios(i).Name
Next
Sheets("flat estimates").ComboBox1.ListIndex = 0
Application.ScreenUpdating = True
Sheets("flat estimates").Range("B10:B21").ClearContents

Application.ScreenUpdating = True
Application.ScreenUpdating = False
Sheets("shingle estimates").Activate
Sheets("shingle estimates").ComboBox2.Clear

Sheets("shingle estimates").ComboBox2.AddItem "-----------------Choose Estimate Type-----------------"
Sheets("shingle estimates").ComboBox2.AddItem "SHINGLE 1 LAYER RIP 6/12 INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "SHINGLE 1 LAYER RIP 7-10/12 INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "SHINGLE 1 LAYER RIP 10/12 UP INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "SHINGLE 1 LAYER RIP 6/12 PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "SHINGLE 1 LAYER RIP 7-10/12 PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "SHINGLE 1 LAYER RIP 10/12 UP PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "SHINGLE 2 LAYER RIP 6/12 INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "SHINGLE 2 LAYER RIP 7-10/12 INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "SHINGLE 2 LAYER RIP 10/12 UP INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "SHINGLE 2 LAYER 6/12 PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "SHINGLE 2 LAYER 7-10/12 PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "SHINGLE 2 LAYER 10/12 UP PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION 6/12 INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION 7-10/12 INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION 10/12 UP INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION 6/12 PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION 7-10/12 PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION 10/12 UP PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION + 1 6/12 INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION + 1 7-10/12 INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION + 1 10/12 UP INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION + 1 6/12 PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION + 1 7-10/12 PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION + 1 10/12 UP PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION + 2 6/12 INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION + 2 7-10/12 INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION + 2 10/12 UP INTO BIN"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION + 2 6/12 PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION + 2 7-10/12 PACKOUT"
Sheets("shingle estimates").ComboBox2.AddItem "CEDAR CONVERSION + 2 10/12 UP PACKOUT"

For i = 1 To Sheets("flat estimates").Scenarios.Count

Next

Sheets("shingle estimates").ComboBox2.ListIndex = 0
Application.ScreenUpdating = True
Sheets("shingle estimates").Range("B16,B17,b19,b20,b21,b23,b24,b29").ClearContents

Application.ScreenUpdating = True
ARBUTUS.show
End Sub
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
ok... i got the code working but the problem is that it deletes the workbook code in the master as well...... so if i understand you right it may be possible to have the code look for a file name??? and if it returns true then not run the code???
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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