Hello,
I am self taught with VBA - been using it for a couple of years now, mainly focusing on writing macros into modules. I haven't really touched on writing code into individual sheets before
At the moment I am trying to set up macros to format my worksheets, and part of that is code that will update the formatting whenever the sheet is selected. I have been able to write the sub that I need within individual worksheets (i.e. private sub worksheet_activate()), but ideally I would like to be able to have this same code automatically inserted when I use the first macro which creates / formats the worksheet in the first place. Is there a way to make this happen?
Up till now the best solution I can think of is to have a blank 'sheet 1' with the code in it and have my macros start by copying that sheet and going from there, but it seems a little awkward. Any suggestions will be gratefully accepted.
My current process (in case it helps to clarify what I want):
- create new Excel workbook
- use a macro which inserts the basic worksheets I will use on all workbooks, as well as a sheet which includes basic information needed for most/all worksheets
- use a further macros for the sheets which I will need in this specific workbook as and when I need them
So ideally I would like code to be inserted at the sheet level automatically, how can this happen?
Thanks
Bookmarks