+ Reply to Thread
Results 1 to 7 of 7

How to add object and procedure in a module?

  1. #1
    Forum Contributor
    Join Date
    11-07-2020
    Location
    Paris
    MS-Off Ver
    Microsoft office 365
    Posts
    175

    How to add object and procedure in a module?

    Good afternoon to the community.
    I saw the video "Learn How To create this amazing excel invice while I built it from scratch" but I have a problem.
    How to create the object "Worksheet" and the procedure "Change"?
    In my case I have just the object "General" and the procedure "Declarations"

    Capture.PNG
    Capture2.PNG



    Thank you for your help.
    Attached Files Attached Files
    Last edited by Luu4466; 09-17-2021 at 11:19 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to add object and procedure in a module?

    You do not need to create the object for the worksheet, it exists by default in that module for that worksheet. All references to worksheet properties and methods are assumed to be for the worksheet that owns this module. Further the object Me can be used to explicitly reference the worksheet.

    To generate the code for the Change event, you just need to click on Change in the dropdown list of Subs--you already have it highlighted in your screenshot.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    11-07-2020
    Location
    Paris
    MS-Off Ver
    Microsoft office 365
    Posts
    175

    Re: How to add object and procedure in a module?

    Thank you for your answer 6StringJazzer. I need to add an information. The screenshot is not my file. I add my file now in attachment.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to add object and procedure in a module?

    I have added Worksheet_Change to the module for your Invoice worksheet. But what do you want it to do?
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    11-07-2020
    Location
    Paris
    MS-Off Ver
    Microsoft office 365
    Posts
    175

    Re: How to add object and procedure in a module?

    Yes! How you did that?
    Thank you a lot!!!!

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: How to add object and procedure in a module?

    It looks like the second screenshot from your video shows it. In the dropdown box, click on "Change" and it will add the code automatically. You can also just type in the code, if you know what to type.

  7. #7
    Forum Contributor
    Join Date
    11-07-2020
    Location
    Paris
    MS-Off Ver
    Microsoft office 365
    Posts
    175

    Re: How to add object and procedure in a module?

    In my original excel, I hadn't the different proposals in the dropdown box object and in the dropdown box procedure.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Compiler error: Member already exist in an object module from which this object module...
    By tecthtowainc in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-08-2019, 02:20 PM
  2. [SOLVED] Member already exists in an object module form which this object module derives error
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-01-2014, 03:14 AM
  3. [SOLVED] How can I call a Module or a sub procedure and run it automatically in current module?
    By qzqzjcjp in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-29-2014, 11:48 AM
  4. [SOLVED] How to use second procedure (the 2nd Sub) results in first procedure in the same module
    By lubbamkt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-11-2014, 10:17 AM
  5. In Procedure: When use Actual Range Object vs Create Local Object Using Set
    By Filibuster in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-20-2012, 02:21 PM
  6. Replies: 3
    Last Post: 10-25-2011, 02:12 PM
  7. [SOLVED] Add Procedure To Module Via VBA
    By Al in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2005, 06:06 PM

Tags for this Thread

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