Transfer Cell Contents to Tab
Note: Bob's code will not fire if the change of value in C2 is a calculated
value due to a formula.
For that you would need a different type of event code.
Private Sub Worksheet_Calculate()
Me.Name = Range("C2").Value
End Sub
Gord Dibben MS Excel MVP
On Thu, 12 Apr 2007 07:27:10 +0800, "Max" wrote:
Here's one from a past post by Bob Phillips which does it ..
(Note that the file must be saved beforehand. A pre-requisite.)
'---------
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "C2" '<===== Change to suit
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
Me.Name = Target.Value
End If
ws_exit:
Application.EnableEvents = True
End Sub
'--------
'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
|