+ Reply to Thread
Results 1 to 4 of 4

What is the use of "Me" keyword in VBA

  1. #1
    Registered User
    Join Date
    12-10-2011
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    56

    What is the use of "Me" keyword in VBA

    Hi All,

    can anyone let me know What is the use of "Me" keyword in VBA

    ex :
    Please Login or Register  to view this content.
    =========
    Please Login or Register  to view this content.
    Last edited by Paul; 12-18-2011 at 07:46 PM. Reason: Added CODE tags for user.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: What is the use of "Me" keyword in VBA

    For macros stored in a SHEET module, "Me" is another way of specifying this code is meant to run on the sheet in which the macro is stored.

    In your example, it's redundant. Macros stored in the sheet module always send unspecific range commands to itself as the sheet. So this:
    Please Login or Register  to view this content.

    ...is the same as:
    Please Login or Register  to view this content.


    If this macro were found in a standard CODE module, then your first version wouldn't work at all, and mine would send the command to whatever the current Activesheet happened to be.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    12-10-2011
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    56

    Re: What is the use of "Me" keyword in VBA

    Thank you!!!!!!!!!!!

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: What is the use of "Me" keyword in VBA

    And ... in the ThisWorkbook module, Me refers to ThisWorkbook, and in a forms module, it refers to the form.
    Entia non sunt multiplicanda sine necessitate

+ 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