Sheet Tab name

  • Thread starter Thread starter pronto
  • Start date Start date
P

pronto

Is there a way to link the name of the sheet tab with a cell? I jus
want to put a text value in a certain cell and the sheet tab name woul
show that text value.

Thanks in advance
 
Hi
you can put this kind of code in your worksheet_change
event (of your worksheet module). e.g. try the following
code:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit
Sub
On Error GoTo errhandler
Application.EnableEvents = False
Me.Name = Target.Value
errhandler:
Application.EnableEvents = True

End Sub


Now each time cell A1 changes your sheet name changes as well
 
This assumes that you want the name change to occur
automatically when the value of the cell is changed. Paste
to the worksheet code module. Change the cell address to
suit:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$10" Then ActiveSheet.Name =
Target.Value
End Sub

Regards,
Greg
 
check to see if this works for you:

sheet1.name = sheet1.range("a1").valu
 
Cool, all 3 of your suggestions worked!

Thanks guys, i really appreciate it
 

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