Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel: Selecting and rename current sheet in a macro.

Status
Not open for further replies.

fiel

Programmer
Jun 3, 2007
96
US
I have set a marco to rename a sheet based on the number entered in a cell, my code is as follows:

Function RenameSheet(place As Integer)

' What needs to go in place of "Me"
' In order to select the current sheet?
Sheets("Me").Select
Sheets("Me").Name = "MCC " & place

End Function

I jsut want to rename the sheet by adding a number at the end, any ideas on how to select only the current sheet that the macro is in?
 
Have you tried ActiveSheet ?
ActiveSheet.Name = "MCC " & place

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
How often do you want the name to change? Do you need to be able to do it on an ongoing basis? Do you want to be able to do it anytime at will?

I saw that Skip suggested using ActiveSheet with a Worksheet Change event in your original thread. Have you explored that? Will it work?

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top