+ Reply to Thread
Results 1 to 4 of 4

Excel Sheets

Hybrid View

  1. #1
    Registered User
    Join Date
    03-24-2006
    Posts
    15

    Excel Sheets

    Hello,

    how can I reference the name of the currently selected sheet, in a macro?

    I tried:

    me.name

    and it only pulls up the name of the first sheet, no matter which sheet I have selected..

    Thanks for any help on this issue..

    Larry

  2. #2
    Dave Peterson
    Guest

    Re: Excel Sheets

    If the code is under a worksheet, then me.name will give you the name of the
    sheet that owns the code.

    You may want: Activesheet.name



    lbargers wrote:
    >
    > Hello,
    >
    > how can I reference the name of the currently selected sheet, in a
    > macro?
    >
    > I tried:
    >
    > me.name
    >
    > and it only pulls up the name of the first sheet, no matter which sheet
    > I have selected..
    >
    > Thanks for any help on this issue..
    >
    > Larry
    >
    > --
    > lbargers
    > ------------------------------------------------------------------------
    > lbargers's Profile: http://www.excelforum.com/member.php...o&userid=32798
    > View this thread: http://www.excelforum.com/showthread...hreadid=532978


    --

    Dave Peterson

  3. #3
    Registered User
    Join Date
    03-24-2006
    Posts
    15
    Hey Dave,

    I should of explained myself better, I would like the code in a Module, this way the user will not have to select between multiple macros. The user should be able to select any sheet in the workbook and exectue the macro..

    Thanks

    Larry

  4. #4
    Dave Peterson
    Guest

    Re: Excel Sheets

    Have the user select the correct sheet first.

    Then you can write your macro to work against the Activesheet.

    With Activesheet
    .range("a1").clearcontents
    end with

    For example.



    lbargers wrote:
    >
    > Hey Dave,
    >
    > I should of explained myself better, I would like the code in a Module,
    > this way the user will not have to select between multiple macros. The
    > user should be able to select any sheet in the workbook and exectue the
    > macro..
    >
    > Thanks
    >
    > Larry
    >
    > --
    > lbargers
    > ------------------------------------------------------------------------
    > lbargers's Profile: http://www.excelforum.com/member.php...o&userid=32798
    > View this thread: http://www.excelforum.com/showthread...hreadid=532978


    --

    Dave Peterson

+ 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