With your workbook open, hit ALT+F11 and this will open the VBE (Visual Basic Editor).
Top left you will hopefully see an explorer style pane. Within this pane you need to search for your workbook's name, and when you find it you may need to click on the + to expand it. Within that you should see something like the following:-
VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
ThisWorkbook
Modules
Module1
Module2
etc etc (You may have just 1 or none of these)
If you have named your sheets then those names will appear in the brackets above as opposed to
what you see at the moment in my note.
Double click the ThisWorkbook bit and it will open up a blank white space with two dropdowns above it. The right dropdown will say General - Click it and choose Workbook and the right dropdown should now default to Open, but if it doesn't then go select Open. You will now see the following:-
Private Sub Workbook_Open()
End Sub
Put your code in between, then hit File / Close and return to Microsoft Excel and save the file.
Done.
Regards
Ken..........
----------------------------------------------------------------------------
![[peace] [peace] [peace]](/data/assets/smilies/peace.gif)
It's easier to beg forgiveness than ask permission
----------------------------------------------------------------------------