From: Cue on
Excuse me...
Is there a way rename the tab with the filename without the ".xls"?
--
Cue


"Cue" wrote:

> Great! Thanks to both of you for your assistance.
>
> One thing i did not account for... Is there a way rename the tab with the
> filename with the ".xls"?
> --
> Cue
From: Cue on
I'll try that. Thanks.
--
Cue


"Bob I" wrote:

> Perhaps assign file name to variable, then assign variable to Tab.
>
> Cue wrote:
> > Hello,
> >
> > I am trying to rename a worksheet tab using the name of the workbook. Each
> > code I've tried does not work. Does anybody have a simple macro to accomplish
> > this?
> >
> > Thanks.
>
> .
>
From: FSt1 on
hi
now you will have to use variables.
Sub nametab()
Dim s As String
Dim ss As String
s = ActiveWorkbook.Name
ss = Left(s, Len(s) - 4)
Sheets("Sheet1").Name = ss
End Sub

regards
FSt1

"Cue" wrote:

> Excuse me...
> Is there a way rename the tab with the filename without the ".xls"?
> --
> Cue
>
>
> "Cue" wrote:
>
> > Great! Thanks to both of you for your assistance.
> >
> > One thing i did not account for... Is there a way rename the tab with the
> > filename with the ".xls"?
> > --
> > Cue
From: מיכאל (מיקי) אבידן on
I would suggest to try the following code.
1) It will work, as expected, in "Excel 2007 and 2010"
2) It may be run from within a Module and it will rename the Active Sheet at
that moment.
There is alao another "workaround" by checking the Excels version and then
cut-off 4 or 5 characters from the end.
----------------------
Sub NameTab()
ActiveSheet.Name = Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name,
".") - 1)
End Sub
--------------
Micky



"Cue" wrote:

> I'll try that. Thanks.
> --
> Cue
>
>
> "Bob I" wrote:
>
> > Perhaps assign file name to variable, then assign variable to Tab.
> >
> > Cue wrote:
> > > Hello,
> > >
> > > I am trying to rename a worksheet tab using the name of the workbook. Each
> > > code I've tried does not work. Does anybody have a simple macro to accomplish
> > > this?
> > >
> > > Thanks.
> >
> > .
> >
From: Cue on
Thanks everyone! All your solutions worked!

I found this similar to CLR solution:

Sheets("Sheet2").Name = Replace(ActiveWorkbook. Name, ".xls", "")

Thanks again everyone for your help!
--
Cue


"Cue" wrote:

> I'll try that. Thanks.
> --
> Cue
>
>
> "Bob I" wrote:
>
> > Perhaps assign file name to variable, then assign variable to Tab.
> >
> > Cue wrote:
> > > Hello,
> > >
> > > I am trying to rename a worksheet tab using the name of the workbook. Each
> > > code I've tried does not work. Does anybody have a simple macro to accomplish
> > > this?
> > >
> > > Thanks.
> >
> > .
> >