We help IT Professionals succeed at work.
Get Started

Add Tab Name to Formula

Last Modified: 2011-10-19
Okay I have what maybe a simple question and then again maybe not.
I have this formula in cell Q6 of every worksheet:

='Week Three'!Q6+7

"Week Three" is the tab name of the sheet before "Week Four".

How can I put this information in that cell when a new sheet is inserted.  Can i add a line of code in the code below to do this? Below is my insertion code:

Function copy_template()
    Dim Index As Long
    Dim NewWorksheet As Worksheet
    Worksheets("Template").Visible = True
    Sheets("Template").Copy before:=Sheets("Misc")
    Worksheets("Template (2)").Visible = True
    Worksheets("Template").Visible = False
    Set NewWorksheet = Worksheets("Template (2)")
    On Error Resume Next
    For Index = 1 To 1000
        NewWorksheet.Name = "Week " & GetSpelledNumber(Index)
        If Err.Number = 0 Then Exit For
    Next Index
End Function

So in other words with I'm insert the template and it reads "Week Five" on the tab, the in cell Q6 should read ='Week Four'!Q6+7.  This will update the fields for each date needed.
Watch Question
Top Expert 2008
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE