Not just declare variable but set names etc for entire workbook????

cizzett

Board Regular
Joined
Jan 10, 2019
Messages
121
Ok, So I have a lot going on in this workbook and just trying to clean up all the script etc in this workbook and wanted to know if it is possible to declare everything below ALONG WITH Setting everything so when I get to the codes I dont have to "Set" anything just use the code like "Ls.Activate" or whatever

Here is everything I want made available across all modules

Code:
Public Wb As WorkbookPublic df As Workbook   ' Defined in Script
Public Pd As Workbook   ' Defined in Script
Public mf As Workbook   ' Defined in Script
Public Wbk As Workbook  ' Defined in Script


Public Ws As Worksheet
Public Ls As Worksheet
Public Fl As Worksheet
Public Ps As Worksheet
Public Es As Worksheet
Public SOS As Worksheet
Public Piv As Worksheet
Public Inst As Worksheet
Public ds As Worksheet   ' Defined in Script
Public Pds As Worksheet  ' Defined in Script
Public ms As Worksheet   ' Defined in Script
Public Nws As Worksheet  'Defined in Script
Public RDPiv As Worksheet ' Defined in Script


Public TT As ListObject
Public PDPT As ListObject
Public PDT As ListObject 'Defined in Script
Public SOST As ListObject  ' Defined in Script
Public SOSDT As ListObject
Public LT As ListObject


Public IPCB As CheckBox
Public SOSCB As CheckBox
Public LPCB As CheckBox
Public RFCB As CheckBox
Public ASCB As CheckBox
Public SAPCB As CheckBox


Public SOSRunCB As CheckBox
Public JDARunCB As CheckBox
Public PDRunCB As CheckBox
Public PLWSRunCB As CheckBox
Public ExPRunCB As CheckBox
Public ASRunCB As CheckBox
Public SAPRunCB As CheckBox


Set Wb = ThisWorkbook
Set Ws = Wb.Sheets("Today")
Set Ls = Wb.Sheets("L.W.S.")
Set Fl = Wb.Sheets("File Locs")
Set Ps = Wb.Sheets("Prev Day")
Set Es = Wb.Sheets("E-mail")
Set SOS = Wb.Sheets("SOS")
Set Piv = Wb.Sheets("Pivot")
Set Inst = Wb.Sheets("Instruction Sheet")


Set PDT = Ps.ListObjects("PD_Table")
Set TT = Ws.ListObjects("TodayTable")
Set SOSDT = SOS.ListObjects("SOSDT")
Set LT = Ls.ListObjects("LotTable")


Set IPCB = Fl.Shapes("IPCB").OLEFormat.Object
Set SOSCB = Fl.Shapes("SOSCB").OLEFormat.Object
Set LPCB = Ws.Shapes("LPCB").OLEFormat.Object
Set RFCB = Fl.Shapes("RFCB").OLEFormat.Object
Set ASCB = Fl.Shapes("ASCB").OLEFormat.Object
Set SAPCB = Fl.Shapes("SAPCB").OLEFormat.Object


Set SOSRunCB = Ws.Shapes("SOSRunCB").OLEFormat.Object
Set JDARunCB = Ws.Shapes("JDARunCB").OLEFormat.Object
Set PDRunCB = Ws.Shapes("PDRunCB").OLEFormat.Object
Set PLWSRunCB = Ws.Shapes("PLWSRunCB").OLEFormat.Object
Set ExPRunCB = Ws.Shapes("ExPRunCB").OLEFormat.Object
Set ASRunCB = Ws.Shapes("ASRunCB").OLEFormat.Object
Set SAPRunCB = Ws.Shapes("SAPRunCB").OLEFormat.Object
 
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,216,087
Messages
6,128,740
Members
449,466
Latest member
Peter Juhnke

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