Closed Thread
Results 1 to 3 of 3

VB Code Location; sheet, workbook, module

  1. #1
    James Hamilton
    Guest

    VB Code Location; sheet, workbook, module

    I'm new to VB. Does it matter whether I put my VB code in the sheet, workbook
    or modules on the VB window?

    Thanks.

  2. #2
    Anne Troy
    Guest

    Re: VB Code Location; sheet, workbook, module

    It sure does. You might want to consider taking Lesson1 of Excel VBA
    Training at http://www.vbaexpress.com/training/

    In a nutshell:
    Put it in a module if you're unsure.
    Anything that you want to occur on a specific worksheet as a result of a
    specific action, put in the worksheet code.
    Anything that you want to occur in the workbook, such as before you close it
    or save it or when you open it, then the code should go in ThisWorkbook.
    Well, there's class modules too. I know Chip Pearson has some good info
    about it. Though it says Excel 97, things haven't changed a whole heckuva
    lot:
    http://www.cpearson.com/excel/events.htm
    *******************
    ~Anne Troy

    www.OfficeArticles.com
    www.MyExpertsOnline.com



    "James Hamilton" <[email protected]> wrote in message
    news:[email protected]...
    > I'm new to VB. Does it matter whether I put my VB code in the sheet,

    workbook
    > or modules on the VB window?
    >
    > Thanks.




  3. #3
    James Hamilton
    Guest

    Re: VB Code Location; sheet, workbook, module

    Many thanks Anne.

    "Anne Troy" wrote:

    > It sure does. You might want to consider taking Lesson1 of Excel VBA
    > Training at http://www.vbaexpress.com/training/
    >
    > In a nutshell:
    > Put it in a module if you're unsure.
    > Anything that you want to occur on a specific worksheet as a result of a
    > specific action, put in the worksheet code.
    > Anything that you want to occur in the workbook, such as before you close it
    > or save it or when you open it, then the code should go in ThisWorkbook.
    > Well, there's class modules too. I know Chip Pearson has some good info
    > about it. Though it says Excel 97, things haven't changed a whole heckuva
    > lot:
    > http://www.cpearson.com/excel/events.htm
    > *******************
    > ~Anne Troy
    >
    > www.OfficeArticles.com
    > www.MyExpertsOnline.com
    >
    >
    >
    > "James Hamilton" <[email protected]> wrote in message
    > news:[email protected]...
    > > I'm new to VB. Does it matter whether I put my VB code in the sheet,

    > workbook
    > > or modules on the VB window?
    > >
    > > Thanks.

    >
    >
    >


Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1