View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Big Rick
 
Posts: n/a
Default Tab Names Changes

Thanks Dave,
This does work better but I would like to take it one stage further.
What I would like is to have a formula in J2 (e.g. Info!A1+7) with Info!A1 =
1/1/06.
Now if Info!A1 were to change, could I have the tab name change automatically.
By the way, I really am clueless when it come to macros. Remember my post on
date formatting last week which started a great debate !) So please can you
answer in laymans terms.

Thanking you in anticipation.
--
Big Rick


"Dave Peterson" wrote:

Worksheet_change waits for you to type something. (Your code checks to see if
you typed something in J3--if not, it doesn't do anything.)

Since J3 is a formula, it's not changed by typing.

You could use the worksheet_calculate event, but I think I'd just start looking
at J2:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "j2"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Me.Name = format(Target.Value, "dd mm")
'me.name = target.text
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

You could use Target.Text if you formatted that cell the way you wanted.