Change sheet tab name from another sheet?

  • Thread starter Thread starter Php
  • Start date Start date
P

Php

Hello!

I have a problem that I need some help with.

I have a woorkbook with 17 sheets and the first one is my "general"
sheet. I wonder if it is possible to change e.g. the tab name on sheet
15 from a cell in my "general" sheet? Does anyone have a VBA code that
could help me out?

All suggestions are welcome.

Thanks,

/Php
 
Hi Php

Sub NameaSheet()
On Error Resume Next
Sheets(15).Name = Sheets("General").Range("A1").Text
End Sub

Errors may beraised by too long name, other sheet with that name exist,
illegal characters in sheet name.

HTH. Best wishes Harald
 
Hi Harald,

Thank you for your answer, but it still does not work. Maybe I placed
the code in the wrong place? Is it supposed to be under the
'ThisWorkBook' or under the specific sheets 'General' or sheet15?

I have tried different places, but the thing I'm confused about is tha
when I change the cell value from e.g. 1 to 5 nothing happens with
sheet15 tab name. Must the code be triggered by something because sheet
15 is not the active sheet when I change the value?

regards
/Php
 
As is you must put the code in a standard module and run the macro manually.
If you want it to happen after typing then you call it from the worksheet's
Change event. See
http://www.cpearson.com/excel/events.htm
on events.

I can't offer a working solution, you explain this very general "to change
e.g. the tab name on sheet 15 from a cell", and which sheet / which cell is
of greatest importance.

HTH
 
Hi again!

Now I think I understand why it is not working. I found this on the
site you posted:

"This event does not occur when the value is changed as the result of a
calculation"

I will try to explain more what I want to happen...

On my general sheet I have 16 cells numered from 1-16. These numbers
changes in the corresponding sheets when I change them. I also want the
sheet tab name to change when I change numbers. All cells are
calculations based on the cell were I type the first value.

Cant it be done because the cell values are results of calculations?

/Php
 
Hi

You have several "calculate" events in the workbook, but that would make it
pretty sluggish. Can't you use the Change event in "the cell were I type the
first value" ?

HTH. Best wishes Harald
 

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