Excel Sheets

L

lbargers

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
 
D

Dave Peterson

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
 
L

lbargers

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
 
D

Dave Peterson

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.
 
Top