close

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

--

Dave Peterson


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: www.excelforum.com/member.php...oamp;userid=32798
View this thread: www.excelforum.com/showthread...hreadid=532978Have the user select the correct sheet first.

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

With Activesheet
.range(quot;a1quot;).clearcontents
end with

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

--

Dave Peterson

arrow
arrow
    全站熱搜

    software 發表在 痞客邦 留言(0) 人氣()