MarkAndrews
Well-known Member
- Joined
- May 2, 2006
- Messages
- 1,970
- Office Version
- 2010
- Platform
- Windows
Is it possible to get the sheet tab name from a cell ?
TIA
TIA
=REPLACE(CELL("filename",$A$1),1,FIND("]",CELL("filename",$A$1)),"")
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
ActiveSheet.Name = [a1]
End Sub
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error Resume Next
If Not Intersect(Target, Range("A1")) Is Nothing Then ActiveSheet.Name = Range("A1").Value
End Sub
Private Sub Worksheet_Calculate()
On Error Resume Next
Sheets(ThisWorksheetName).Name = Range("A1").Value
End Sub
If the referenced values are likely to change (ie B1 and D1) then you need a calculation event:
Code:Private Sub Worksheet_Calculate() On Error Resume Next Sheets(ThisWorksheetName).Name = Range("A1").Value End Sub
This will work, but suffers from similar inefficiencies as the SelectionChange event does - this could be avoided with some other coding, but depending on your circumstances, I think that's overkill.
Richard