Help!

Rename all existing worksheet tabs

 
  

Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Excel General (archive) RSS
Next:  How do I change the width of the data validation ..  
Author Message
MikeM
External


Since: Aug 17, 2005
Posts: 11



PostPosted: Wed Aug 17, 2005 1:03 pm    Post subject: Rename all existing worksheet tabs
Archived from groups: microsoft>public>excel>misc (more info?)

I would like to take an existing workbook and rename all the worksheet tabs
at one time. For example, I might have ten worksheets with various names and
I'd like them all to be named USA1, USA2, USA3 and so on.

Can this be easily done with some VBA code? (I've seen some similar
questions, but none exactly like this one.)

Thanks.
Back to top
Bob Phillips
External


Since: Jun 08, 2004
Posts: 5103



PostPosted: Wed Aug 17, 2005 9:20 pm    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Const sBase as string = "USA"
Dim i as long
Dim sh As Object

For Each sh In Activeworkbook.Sheets
i = i + 1
sh.name = sBase & i
Next sh

--

HTH

RP
(remove nothere from the email address if mailing direct)


"MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
news:ECE18B9C-D5AB-4D2C-9807-137E2CF24FD7@microsoft.com...
> I would like to take an existing workbook and rename all the worksheet
tabs
> at one time. For example, I might have ten worksheets with various names
and
> I'd like them all to be named USA1, USA2, USA3 and so on.
>
> Can this be easily done with some VBA code? (I've seen some similar
> questions, but none exactly like this one.)
>
> Thanks.
Back to top
MikeM
External


Since: Aug 17, 2005
Posts: 11



PostPosted: Wed Aug 17, 2005 9:20 pm    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Bob:
Thanks so much for your quick reply! I tried it and it works perfectly.

Could it be set up so I could define the worksheet name before running the
macro? (by typing it into a cell or something like that)?

For example, one workbook might need to be USA1, USA2, etc. and another
might need to be CANADA1, CANADA2, etc.

"Bob Phillips" wrote:

> Const sBase as string = "USA"
> Dim i as long
> Dim sh As Object
>
> For Each sh In Activeworkbook.Sheets
> i = i + 1
> sh.name = sBase & i
> Next sh
>
> --
>
> HTH
>
> RP
> (remove nothere from the email address if mailing direct)
>
>
> "MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
> news:ECE18B9C-D5AB-4D2C-9807-137E2CF24FD7@microsoft.com...
> > I would like to take an existing workbook and rename all the worksheet
> tabs
> > at one time. For example, I might have ten worksheets with various names
> and
> > I'd like them all to be named USA1, USA2, USA3 and so on.
> >
> > Can this be easily done with some VBA code? (I've seen some similar
> > questions, but none exactly like this one.)
> >
> > Thanks.
>
>
>
Back to top
Bob Phillips
External


Since: Jun 08, 2004
Posts: 5103



PostPosted: Wed Aug 17, 2005 10:03 pm    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Mike,

This will get it from A1 on Sheet1, change to suit

Dim sBase as string
Dim i as long
Dim sh As Object

sBase = Worksheets("Sheet1").Range("A1").Value
For Each sh In Activeworkbook.Sheets
i = i + 1
sh.name = sBase & i
Next sh



--

HTH

RP
(remove nothere from the email address if mailing direct)


"MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
news:4105ED1A-CAB2-4CA1-A600-FA17E52AFAC3@microsoft.com...
> Bob:
> Thanks so much for your quick reply! I tried it and it works perfectly.
>
> Could it be set up so I could define the worksheet name before running the
> macro? (by typing it into a cell or something like that)?
>
> For example, one workbook might need to be USA1, USA2, etc. and another
> might need to be CANADA1, CANADA2, etc.
>
> "Bob Phillips" wrote:
>
> > Const sBase as string = "USA"
> > Dim i as long
> > Dim sh As Object
> >
> > For Each sh In Activeworkbook.Sheets
> > i = i + 1
> > sh.name = sBase & i
> > Next sh
> >
> > --
> >
> > HTH
> >
> > RP
> > (remove nothere from the email address if mailing direct)
> >
> >
> > "MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
> > news:ECE18B9C-D5AB-4D2C-9807-137E2CF24FD7@microsoft.com...
> > > I would like to take an existing workbook and rename all the worksheet
> > tabs
> > > at one time. For example, I might have ten worksheets with various
names
> > and
> > > I'd like them all to be named USA1, USA2, USA3 and so on.
> > >
> > > Can this be easily done with some VBA code? (I've seen some similar
> > > questions, but none exactly like this one.)
> > >
> > > Thanks.
> >
> >
> >
Back to top
David McRitchie
External


Since: Jul 28, 2005
Posts: 1687



PostPosted: Wed Aug 17, 2005 10:03 pm    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Or more likely set up the prefix with an InputBox

sBase = Application.InputBox("Supply Prefix for worksheet renaming", _
"Rename worksheets", "USA")
If sBase = "" Then
MsgBox "Cancelled by your command"
exit sub
end if

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Bob Phillips" <bob.phillips.DeleteThis@notheretiscali.co.uk> wrote in message news:uiv0e82oFHA.2152@TK2MSFTNGP14.phx.gbl...
> Mike,
>
> This will get it from A1 on Sheet1, change to suit
>
> Dim sBase as string
> Dim i as long
> Dim sh As Object
>
> sBase = Worksheets("Sheet1").Range("A1").Value
> For Each sh In Activeworkbook.Sheets
> i = i + 1
> sh.name = sBase & i
> Next sh
>
>
>
> --
>
> HTH
>
> RP
> (remove nothere from the email address if mailing direct)
>
>
> "MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
> news:4105ED1A-CAB2-4CA1-A600-FA17E52AFAC3@microsoft.com...
> > Bob:
> > Thanks so much for your quick reply! I tried it and it works perfectly.
> >
> > Could it be set up so I could define the worksheet name before running the
> > macro? (by typing it into a cell or something like that)?
> >
> > For example, one workbook might need to be USA1, USA2, etc. and another
> > might need to be CANADA1, CANADA2, etc.
> >
> > "Bob Phillips" wrote:
> >
> > > Const sBase as string = "USA"
> > > Dim i as long
> > > Dim sh As Object
> > >
> > > For Each sh In Activeworkbook.Sheets
> > > i = i + 1
> > > sh.name = sBase & i
> > > Next sh
> > >
> > > --
> > >
> > > HTH
> > >
> > > RP
> > > (remove nothere from the email address if mailing direct)
> > >
> > >
> > > "MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
> > > news:ECE18B9C-D5AB-4D2C-9807-137E2CF24FD7@microsoft.com...
> > > > I would like to take an existing workbook and rename all the worksheet
> > > tabs
> > > > at one time. For example, I might have ten worksheets with various
> names
> > > and
> > > > I'd like them all to be named USA1, USA2, USA3 and so on.
> > > >
> > > > Can this be easily done with some VBA code? (I've seen some similar
> > > > questions, but none exactly like this one.)
> > > >
> > > > Thanks.
> > >
> > >
> > >
>
>
Back to top
MikeM
External


Since: Aug 17, 2005
Posts: 11



PostPosted: Wed Aug 17, 2005 10:03 pm    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

David:
I tried this solution and it works nicely as well. Many thanks!
Mike

"David McRitchie" wrote:

> Or more likely set up the prefix with an InputBox
>
> sBase = Application.InputBox("Supply Prefix for worksheet renaming", _
> "Rename worksheets", "USA")
> If sBase = "" Then
> MsgBox "Cancelled by your command"
> exit sub
> end if
>
> ---
> HTH,
> David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
> My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
> Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
>
> "Bob Phillips" <bob.phillips.TakeThisOut@notheretiscali.co.uk> wrote in message news:uiv0e82oFHA.2152@TK2MSFTNGP14.phx.gbl...
> > Mike,
> >
> > This will get it from A1 on Sheet1, change to suit
> >
> > Dim sBase as string
> > Dim i as long
> > Dim sh As Object
> >
> > sBase = Worksheets("Sheet1").Range("A1").Value
> > For Each sh In Activeworkbook.Sheets
> > i = i + 1
> > sh.name = sBase & i
> > Next sh
> >
> >
> >
> > --
> >
> > HTH
> >
> > RP
> > (remove nothere from the email address if mailing direct)
> >
> >
> > "MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
> > news:4105ED1A-CAB2-4CA1-A600-FA17E52AFAC3@microsoft.com...
> > > Bob:
> > > Thanks so much for your quick reply! I tried it and it works perfectly.
> > >
> > > Could it be set up so I could define the worksheet name before running the
> > > macro? (by typing it into a cell or something like that)?
> > >
> > > For example, one workbook might need to be USA1, USA2, etc. and another
> > > might need to be CANADA1, CANADA2, etc.
> > >
> > > "Bob Phillips" wrote:
> > >
> > > > Const sBase as string = "USA"
> > > > Dim i as long
> > > > Dim sh As Object
> > > >
> > > > For Each sh In Activeworkbook.Sheets
> > > > i = i + 1
> > > > sh.name = sBase & i
> > > > Next sh
> > > >
> > > > --
> > > >
> > > > HTH
> > > >
> > > > RP
> > > > (remove nothere from the email address if mailing direct)
> > > >
> > > >
> > > > "MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
> > > > news:ECE18B9C-D5AB-4D2C-9807-137E2CF24FD7@microsoft.com...
> > > > > I would like to take an existing workbook and rename all the worksheet
> > > > tabs
> > > > > at one time. For example, I might have ten worksheets with various
> > names
> > > > and
> > > > > I'd like them all to be named USA1, USA2, USA3 and so on.
> > > > >
> > > > > Can this be easily done with some VBA code? (I've seen some similar
> > > > > questions, but none exactly like this one.)
> > > > >
> > > > > Thanks.
> > > >
> > > >
> > > >
> >
> >
>
>
>
Back to top
Bob Phillips
External


Since: Jun 08, 2004
Posts: 5103



PostPosted: Wed Aug 17, 2005 11:09 pm    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Don't like InputBox Dave, would much rather type in a cell. Too easy to make
a mistake, maybe not with USA, but easy with Kazakhstan.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"David McRitchie" <dmcritchie_xlmvp.RemoveThis@verizon.net> wrote in message
news:OC48hF3oFHA.1044@tk2msftngp13.phx.gbl...
> Or more likely set up the prefix with an InputBox
>
> sBase = Application.InputBox("Supply Prefix for worksheet renaming",
_
> "Rename worksheets", "USA")
> If sBase = "" Then
> MsgBox "Cancelled by your command"
> exit sub
> end if
>
> ---
> HTH,
> David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
> My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
> Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
>
> "Bob Phillips" <bob.phillips.RemoveThis@notheretiscali.co.uk> wrote in message
news:uiv0e82oFHA.2152@TK2MSFTNGP14.phx.gbl...
> > Mike,
> >
> > This will get it from A1 on Sheet1, change to suit
> >
> > Dim sBase as string
> > Dim i as long
> > Dim sh As Object
> >
> > sBase = Worksheets("Sheet1").Range("A1").Value
> > For Each sh In Activeworkbook.Sheets
> > i = i + 1
> > sh.name = sBase & i
> > Next sh
> >
> >
> >
> > --
> >
> > HTH
> >
> > RP
> > (remove nothere from the email address if mailing direct)
> >
> >
> > "MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
> > news:4105ED1A-CAB2-4CA1-A600-FA17E52AFAC3@microsoft.com...
> > > Bob:
> > > Thanks so much for your quick reply! I tried it and it works
perfectly.
> > >
> > > Could it be set up so I could define the worksheet name before running
the
> > > macro? (by typing it into a cell or something like that)?
> > >
> > > For example, one workbook might need to be USA1, USA2, etc. and
another
> > > might need to be CANADA1, CANADA2, etc.
> > >
> > > "Bob Phillips" wrote:
> > >
> > > > Const sBase as string = "USA"
> > > > Dim i as long
> > > > Dim sh As Object
> > > >
> > > > For Each sh In Activeworkbook.Sheets
> > > > i = i + 1
> > > > sh.name = sBase & i
> > > > Next sh
> > > >
> > > > --
> > > >
> > > > HTH
> > > >
> > > > RP
> > > > (remove nothere from the email address if mailing direct)
> > > >
> > > >
> > > > "MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
> > > > news:ECE18B9C-D5AB-4D2C-9807-137E2CF24FD7@microsoft.com...
> > > > > I would like to take an existing workbook and rename all the
worksheet
> > > > tabs
> > > > > at one time. For example, I might have ten worksheets with
various
> > names
> > > > and
> > > > > I'd like them all to be named USA1, USA2, USA3 and so on.
> > > > >
> > > > > Can this be easily done with some VBA code? (I've seen some
similar
> > > > > questions, but none exactly like this one.)
> > > > >
> > > > > Thanks.
> > > >
> > > >
> > > >
> >
> >
>
>
Back to top
MikeM
External


Since: Aug 17, 2005
Posts: 11



PostPosted: Wed Aug 17, 2005 11:09 pm    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Many thanks to you Bob, and David as well for such quick and informative
responses. This is the first time I've posted a question here and will
certainly continue to do so in the future!
Mike

"Bob Phillips" wrote:

> Don't like InputBox Dave, would much rather type in a cell. Too easy to make
> a mistake, maybe not with USA, but easy with Kazakhstan.
>
> --
>
> HTH
>
> RP
> (remove nothere from the email address if mailing direct)
>
>
> "David McRitchie" <dmcritchie_xlmvp.DeleteThis@verizon.net> wrote in message
> news:OC48hF3oFHA.1044@tk2msftngp13.phx.gbl...
> > Or more likely set up the prefix with an InputBox
> >
> > sBase = Application.InputBox("Supply Prefix for worksheet renaming",
> _
> > "Rename worksheets", "USA")
> > If sBase = "" Then
> > MsgBox "Cancelled by your command"
> > exit sub
> > end if
> >
> > ---
> > HTH,
> > David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
> > My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
> > Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
> >
> > "Bob Phillips" <bob.phillips.DeleteThis@notheretiscali.co.uk> wrote in message
> news:uiv0e82oFHA.2152@TK2MSFTNGP14.phx.gbl...
> > > Mike,
> > >
> > > This will get it from A1 on Sheet1, change to suit
> > >
> > > Dim sBase as string
> > > Dim i as long
> > > Dim sh As Object
> > >
> > > sBase = Worksheets("Sheet1").Range("A1").Value
> > > For Each sh In Activeworkbook.Sheets
> > > i = i + 1
> > > sh.name = sBase & i
> > > Next sh
> > >
> > >
> > >
> > > --
> > >
> > > HTH
> > >
> > > RP
> > > (remove nothere from the email address if mailing direct)
> > >
> > >
> > > "MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
> > > news:4105ED1A-CAB2-4CA1-A600-FA17E52AFAC3@microsoft.com...
> > > > Bob:
> > > > Thanks so much for your quick reply! I tried it and it works
> perfectly.
> > > >
> > > > Could it be set up so I could define the worksheet name before running
> the
> > > > macro? (by typing it into a cell or something like that)?
> > > >
> > > > For example, one workbook might need to be USA1, USA2, etc. and
> another
> > > > might need to be CANADA1, CANADA2, etc.
> > > >
> > > > "Bob Phillips" wrote:
> > > >
> > > > > Const sBase as string = "USA"
> > > > > Dim i as long
> > > > > Dim sh As Object
> > > > >
> > > > > For Each sh In Activeworkbook.Sheets
> > > > > i = i + 1
> > > > > sh.name = sBase & i
> > > > > Next sh
> > > > >
> > > > > --
> > > > >
> > > > > HTH
> > > > >
> > > > > RP
> > > > > (remove nothere from the email address if mailing direct)
> > > > >
> > > > >
> > > > > "MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
> > > > > news:ECE18B9C-D5AB-4D2C-9807-137E2CF24FD7@microsoft.com...
> > > > > > I would like to take an existing workbook and rename all the
> worksheet
> > > > > tabs
> > > > > > at one time. For example, I might have ten worksheets with
> various
> > > names
> > > > > and
> > > > > > I'd like them all to be named USA1, USA2, USA3 and so on.
> > > > > >
> > > > > > Can this be easily done with some VBA code? (I've seen some
> similar
> > > > > > questions, but none exactly like this one.)
> > > > > >
> > > > > > Thanks.
> > > > >
> > > > >
> > > > >
> > >
> > >
> >
> >
>
>
>
Back to top
dford
External


Since: Apr 08, 2006
Posts: 50



PostPosted: Tue May 30, 2006 6:09 am    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I would like to rename just selected worksheets. Could a modification of this
code be possible?

"Bob Phillips" wrote:

> Const sBase as string = "USA"
> Dim i as long
> Dim sh As Object
>
> For Each sh In Activeworkbook.Sheets
> i = i + 1
> sh.name = sBase & i
> Next sh
>
> --
>
> HTH
>
> RP
> (remove nothere from the email address if mailing direct)
>
>
> "MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
> news:ECE18B9C-D5AB-4D2C-9807-137E2CF24FD7@microsoft.com...
> > I would like to take an existing workbook and rename all the worksheet
> tabs
> > at one time. For example, I might have ten worksheets with various names
> and
> > I'd like them all to be named USA1, USA2, USA3 and so on.
> >
> > Can this be easily done with some VBA code? (I've seen some similar
> > questions, but none exactly like this one.)
> >
> > Thanks.
>
>
>
Back to top
Bob Phillips
External


Since: May 25, 2006
Posts: 2352



PostPosted: Tue May 30, 2006 2:42 pm    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Const sBase As String = "USA"
Dim i As Long
Dim sh As Object

For Each sh In ActiveWorkbook.Windows(1).SelectedSheets
i = i + 1
sh.Name = sBase & i
Next sh

--
HTH

Bob Phillips

(replace somewhere in email address with googlemail if mailing direct)

"dford" <dford.RemoveThis@discussions.microsoft.com> wrote in message
news:741C6203-2665-4EEB-9011-20F06678D1D9@microsoft.com...
> I would like to rename just selected worksheets. Could a modification of
this
> code be possible?
>
> "Bob Phillips" wrote:
>
> > Const sBase as string = "USA"
> > Dim i as long
> > Dim sh As Object
> >
> > For Each sh In Activeworkbook.Sheets
> > i = i + 1
> > sh.name = sBase & i
> > Next sh
> >
> > --
> >
> > HTH
> >
> > RP
> > (remove nothere from the email address if mailing direct)
> >
> >
> > "MikeM" <michael[dot]mittelmanl[at]db[dot]com> wrote in message
> > news:ECE18B9C-D5AB-4D2C-9807-137E2CF24FD7@microsoft.com...
> > > I would like to take an existing workbook and rename all the worksheet
> > tabs
> > > at one time. For example, I might have ten worksheets with various
names
> > and
> > > I'd like them all to be named USA1, USA2, USA3 and so on.
> > >
> > > Can this be easily done with some VBA code? (I've seen some similar
> > > questions, but none exactly like this one.)
> > >
> > > Thanks.
> >
> >
> >
Back to top
rizello
External


Since: Jun 26, 2006
Posts: 5



PostPosted: Wed Oct 04, 2006 12:13 pm    Post subject: RE: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hello:

I would like to do this also. Is it possible to do without using VBA, but
simply a command in Excel?

"MikeM" wrote:

> I would like to take an existing workbook and rename all the worksheet tabs
> at one time. For example, I might have ten worksheets with various names and
> I'd like them all to be named USA1, USA2, USA3 and so on.
>
> Can this be easily done with some VBA code? (I've seen some similar
> questions, but none exactly like this one.)
>
> Thanks.
Back to top
Dave Peterson
External


Since: Jul 08, 2005
Posts: 16049



PostPosted: Wed Oct 04, 2006 4:51 pm    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

There's not in Excel's user interface that would allow you do to lots of renames
all at once. You'd need a macro or do it manually (over and over).

rizello wrote:
>
> Hello:
>
> I would like to do this also. Is it possible to do without using VBA, but
> simply a command in Excel?
>
> "MikeM" wrote:
>
> > I would like to take an existing workbook and rename all the worksheet tabs
> > at one time. For example, I might have ten worksheets with various names and
> > I'd like them all to be named USA1, USA2, USA3 and so on.
> >
> > Can this be easily done with some VBA code? (I've seen some similar
> > questions, but none exactly like this one.)
> >
> > Thanks.

--

Dave Peterson
Back to top
Wally
External


Since: Aug 01, 2006
Posts: 13



PostPosted: Tue Oct 17, 2006 9:15 pm    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I have a similar need, but wish to rename the tabs by referencing the same
cell on each worksheet that contains an invoice number.

"Dave Peterson" wrote:

> There's not in Excel's user interface that would allow you do to lots of renames
> all at once. You'd need a macro or do it manually (over and over).
>
> rizello wrote:
> >
> > Hello:
> >
> > I would like to do this also. Is it possible to do without using VBA, but
> > simply a command in Excel?
> >
> > "MikeM" wrote:
> >
> > > I would like to take an existing workbook and rename all the worksheet tabs
> > > at one time. For example, I might have ten worksheets with various names and
> > > I'd like them all to be named USA1, USA2, USA3 and so on.
> > >
> > > Can this be easily done with some VBA code? (I've seen some similar
> > > questions, but none exactly like this one.)
> > >
> > > Thanks.
>
> --
>
> Dave Peterson
>
Back to top
Dave Peterson
External


Since: Jul 08, 2005
Posts: 16049



PostPosted: Wed Oct 18, 2006 7:49 am    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

One way:

Option Explicit
Sub testme01()
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
With wks
On Error Resume Next
.Name = .Range("a1").Text
If Err.Number <> 0 Then
MsgBox .Name & " was not renamed"
Err.Clear
End If
On Error GoTo 0
End With
Next wks
End Sub

Wally wrote:
>
> I have a similar need, but wish to rename the tabs by referencing the same
> cell on each worksheet that contains an invoice number.
>
> "Dave Peterson" wrote:
>
> > There's not in Excel's user interface that would allow you do to lots of renames
> > all at once. You'd need a macro or do it manually (over and over).
> >
> > rizello wrote:
> > >
> > > Hello:
> > >
> > > I would like to do this also. Is it possible to do without using VBA, but
> > > simply a command in Excel?
> > >
> > > "MikeM" wrote:
> > >
> > > > I would like to take an existing workbook and rename all the worksheet tabs
> > > > at one time. For example, I might have ten worksheets with various names and
> > > > I'd like them all to be named USA1, USA2, USA3 and so on.
> > > >
> > > > Can this be easily done with some VBA code? (I've seen some similar
> > > > questions, but none exactly like this one.)
> > > >
> > > > Thanks.
> >
> > --
> >
> > Dave Peterson
> >

--

Dave Peterson
Back to top
Wally
External


Since: Aug 01, 2006
Posts: 13



PostPosted: Thu Oct 19, 2006 7:29 pm    Post subject: Re: Rename all existing worksheet tabs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

WOW! It's magic. Thank You Dave

"Dave Peterson" wrote:

> One way:
>
> Option Explicit
> Sub testme01()
> Dim wks As Worksheet
> For Each wks In ActiveWorkbook.Worksheets
> With wks
> On Error Resume Next
> .Name = .Range("a1").Text
> If Err.Number <> 0 Then
> MsgBox .Name & " was not renamed"
> Err.Clear
> End If
> On Error GoTo 0
> End With
> Next wks
> End Sub
>
> Wally wrote:
> >
> > I have a similar need, but wish to rename the tabs by referencing the same
> > cell on each worksheet that contains an invoice number.
> >
> > "Dave Peterson" wrote:
> >
> > > There's not in Excel's user interface that would allow you do to lots of renames
> > > all at once. You'd need a macro or do it manually (over and over).
> > >
> > > rizello wrote:
> > > >
> > > > Hello:
> > > >
> > > > I would like to do this also. Is it possible to do without using VBA, but
> > > > simply a command in Excel?
> > > >
> > > > "MikeM" wrote:
> > > >
> > > > > I would like to take an existing workbook and rename all the worksheet tabs
> > > > > at one time. For example, I might have ten worksheets with various names and
> > > > > I'd like them all to be named USA1, USA2, USA3 and so on.
> > > > >
> > > > > Can this be easily done with some VBA code? (I've seen some similar
> > > > > questions, but none exactly like this one.)
> > > > >
> > > > > Thanks.
> > >
> > > --
> > >
> > > Dave Peterson
> > >
>
> --
>
> Dave Peterson
>
Back to top
martynlyne



Joined: Jan 09, 2009
Posts: 1



PostPosted: Fri Jan 09, 2009 3:53 pm    Post subject: Rename worksheets from list/range [Login to view extended thread Info.]

Hi

I would like to rename all worksheets in a workbook but pull the name information from a list / range on a page. Thanks

Martyn
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Excel General (archive) All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum