Active Sheet name

AlexanderBB

Well-known Member
Joined
Jul 1, 2009
Messages
1,953
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Is the active sheet name available from the Target Object ?
Is yes it would save me sending both to a function.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Hi there,

Do you mean like this:

VBA Code:
MsgBox Target.Worksheet.Name

Regards,

Robert
 
Upvote 0
Solution
Hi AlexanderBB

You might try this...I believe you can do this

Sub GetActiveSheetName()
Dim sheetName As String
sheetName = ActiveSheet.Name
MsgBox sheetName
End Sub

hope this helps

plettieri
 
Upvote 0
Just to give you some other ideas.
If your code is inside a Sheet Module then the keyword "Me" will refer to the Sheet
ie Me.Name will get you the Sheet Name
I had not thought of using "Worksheet" to get the Name and am more used to Target.Parent.Name
Note: ActiveSheet is the ActiveSheet regardless of any range reference.
 
Upvote 0
I'm sending Target as Object into a class module. If I didn't need to send in the name as a 2nd argument it seemed a bit neater.
Will remember Me so refers to sheet or Form. Good to know.
 
Upvote 0

Forum statistics

Threads
1,221,525
Messages
6,160,328
Members
451,637
Latest member
hvp2262

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top