View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jak Jak is offline
external usenet poster
 
Posts: 8
Default Worksheet Tab Name from Cell C4

Gary,

Thank you so much, your very simple code and clear instructions worked very
well! I do have one follow up question however. I currently have a macro to
copy the original worksheet named 'server'. If I change the name of the
worksheet tab with this code it breaks the macro to copy. Can you tell me
how to make "Server" a variable for the current worksheet. Also, is there a
way to tell it to copy to the end instead of after "Sheet (2)"

Sub CopySheet()
'
' CopySheet Macro
' Macro recorded 6/23/2008 by Jason A. Koller
'

'
Sheets("Server").Select
Sheets("Server").Copy After:=Sheets(2)
End Sub

Thanks again Gary... and Tom for the link to learn about how to use someone
elses macro's!

Jason

"Gary Brown" wrote:

In the VBEditor, put the following in the worksheet to be copied.
Everytime you go to that worksheet, the macro will fire and change the
worksheet's name to whatever is in cell C4 of that worksheet. If the name is
illegal, the worksheet will not change the name.

Private Sub Worksheet_Activate()
On Error Resume Next
ActiveSheet.Name = Range("C4").Value
End Sub

--
Hope this helps.
If this post was helpfull, please remember to click on the ''YES'' button at
the bottom of the screen.
Thanks,
Gary Brown


"JAK" wrote:

I have a worksheet that I would like to have the Tab automatically rename
itself to whatever value is in Cell C4. This worksheet will be copied (via
copy worksheet macro) multiple times (move to end with create a copy option
checked). I have never used VBA in Excel so I am not sure how to make this
work. I tried using what you had suggested for Wally but couldn't make that
work for me.