+ Reply to Thread
Results 1 to 4 of 4

Basic Information

  1. #1
    Registered User
    Join Date
    10-06-2006
    Posts
    15

    Basic Information

    I am a beginning VB programmer and I have taken a look at Excel but do not understand from the start. When I enter the VB editor, what are the Microsoft Excel Objects for? I know they are the places where code is placed but what goes into the Sheet objects, the Module objects, and ThisWorkbook object? How do you know where to place your code within these objects? Let's say I was writing a complicated macro. What would go in the Sheet, what would go in the Module(s) and what would go in ThisWorkbook? Does this make sense?

  2. #2
    Forum Contributor
    Join Date
    12-12-2005
    Posts
    667
    Buy a good book on Excel or follow a course, once you have done this people in this forum will help you. It is far too complicated for us to explain here!
    Good luck!
    Best regards,

    Ray

  3. #3
    Registered User
    Join Date
    10-06-2006
    Posts
    15
    Quote Originally Posted by raypayette
    Buy a good book on Excel or follow a course, once you have done this people in this forum will help you. It is far too complicated for us to explain here!
    Good luck!

    I have bought 3 Excel/VB books and none of them explain this, they simply jump into programming or making macros. I am really just looking for a summary not a full explaination.

  4. #4
    Forum Contributor
    Join Date
    12-12-2005
    Posts
    667
    Most code go in a Standard module that is any Module that is in the Modules Object.

    Sheet code relate to events that are specific to a sheet such as:
    Private Sub Worksheet_Change(ByVal Target As Range)

    End Sub
    that will be triggered when a change occurs in that sheet.

    Thewre are code that are specific to a workbook such as :
    Private Sub Workbook_BeforeClose(Cancel As Boolean)

    End Sub
    that could do a particular save before closing the workbook.

    If You create a Userform with Insert, Userform, there will be code specific to the controls that you may add on the form such as the click of a button.

    To activate a Userform place this code in a Standard module:
    Sub Main()
    UserForm1.Show
    End Sub
    and run it.

    The public declarations usually are the first code in a standard module.

+ Reply to 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