=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))+1,256)
Mike
Rick
"Mike H" <Mi...@discussions.microsoft.com> wrote in message
news:7F67AF84-B5C5-4228...@microsoft.com...
Sub PutTabNameInActiveCell()
ActiveCell.Value = ActiveSheet.Name
End Sub
Rick
"balder" <bal...@discussions.microsoft.com> wrote in message
news:1C421EA7-F849-4FDE...@microsoft.com...
Thanks for correcting the correction. <g>
Rick
"Mike H" <Mi...@discussions.microsoft.com> wrote in message
news:3847BDF2-9C44-400B...@microsoft.com...
"Mike H" wrote:
It worked!! Thank you very much. Another challenge perhaps - how to make a
tab name equal the content of a spreadsheet cell?
Rune
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1" '<== change to suit
On Error GoTo ws_exit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Me.Name = .Value
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
This is sheet event code. Right-click on the sheet tab and "View Code"
Copy/paste into that sheet module. Adjust "A1" to suit then Alt + q to go back
to the Excel window to test by entering a value in A1
Gord Dibben MS Excel MVP
On Sat, 5 Apr 2008 13:47:00 -0700, balder <bal...@discussions.microsoft.com>
wrote:
I too tried it and it works. But what is the significance
of " +1,256" ?
TIA
JohnL
Try the formula
=CELL("filename",A1)
and you see the full path
The +1 is part of the Find function and it gives the start number where it
finds the ] character in that string and for the sheet name you start 1
character after that or +1
The 256 is how many characters to display for the Sheet name. reduce this to
2 and you get the first 2 characters . 256 is overkill but it does ensure you
get the full sheet name.
Mike
Regards,
Ryan--
--
RyGuy
"Rick Rothstein (MVP - VB)" wrote:
Rick
"ryguy7272" <rygu...@discussions.microsoft.com> wrote in message
news:06190204-969B-45F6...@microsoft.com...
No tab name from cell code.
Gord