Excel Sheets

  • Thread starter Thread starter lbargers
  • Start date Start date
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
 
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
 
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
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top