• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

capture/return name of active worksheet

r121a947

New Member
What is a good expression to capture/return the name of the active worksheet in the active workbook? This has been frustrating me for a while.

What is a good expression to capture/return the active range of the active worksheet in the active workbook?

Thank you for your assistance.
 

Chihiro

Excel Ninja
Depends.

1. ActiveSheet.Name would capture active worksheet's name.
2. Selection is used for active range/object.

I'd recommend detailing how you wish to use this in your project.
In most cases, you don't need to use active range in code. And it is prone to slowing down codes.
 

r121a947

New Member
Thank you.

I am trying to use a variable to change the sheet name in the code from "Sheet1" when I record a macro and try to edit it be flexible.

The problem was I was writing it backwards . . . It must be

wsName = ActiveSheet.Name

not the reverse.

Thank you for your interest and your assistance.
 
Top