• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How do we know which codes apply to workbooks and worksheets

HelpShaneExcel

New Member
Hi all! I'm pretty new to VBA and pretty much just started diving in to this stuff very recently. (We're in need of some major overhauls on our workbooks here at work so I figured why not start learning this stuff)

So how do we set up codes that apply to an entire workbook? By putting them into 'modules'?

If we create a VBA Macro that we want to apply to every worksheet throughout the workbook, is there a way to make all the sheets behave according to the code automatically throughout the workbook? Or do we have to assign the macro (module?) to each existing worksheet individually?

Does it go under 'modules', or does code get copied into the right-click 'view code' on each worksheet tab. I'm really lost with these basic things and think that it is stumping me from progressing in my ability to code.
 
So when I did a search last time online I didn't find what I was looking for. But I re-worded my search and just found a video on this that's already helping me. (Although I'd still appreciate any additional help)

The video maker is explaining the 5 different places to put VBA/Macro codes:

Sheet Module
This Workbook Module
Code Module
Userform Module
Class Module

He's really covering the first three in this video, but this is kind of what I was asking. I really wasn't sure where to put what code and now it is starting to make more sense.

 
Back
Top