Re: Rename Parent work***.name?
- From: "Chip Pearson" <chip@xxxxxxxxxxxx>
- Date: Thu, 15 Nov 2007 14:35:43 -0600
The Parent of a Work*** is a Workbook, and a Workbook cannot be renamed. The only way to change the name of a Workbook is to do a SaveAs to a new file name. Thus, code like
Dim WS As Work***
Set WS = Worksheets(1)
WS.Parent.Name = "abc"
will fail. The Range object has a Parent property that returns the work*** containing the range, and that can be renamed:
Dim RR As Range
Set RR = Worksheets(1).Range("A1")
RR.Parent.Name = "New Name"
--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)
"Rick S." <RickS@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:87473677-9C38-4A7B-9944-5E8DEE9CA0D7@xxxxxxxxxxxxxxxx
I know how to rename a worksheet in VBA, ***Sheets(i).Name = "Sheet" & i"***,
but I can not seem to rename the parent name.
Using ***Sheets(i).Parent.Name*** errors out. (invalid assignment?)
If I create a work*** it counts and adds to the parent name so I could end
up with Sheet15(Sheet2) what I want is Sheet2(Sheet2).
Thank you in advance.
--
Regards
Rick
XP Pro
Office 2007
.
- Prev by Date: Re: Rename Parent work***.name?
- Next by Date: Re: Hide Code
- Previous by thread: Re: Rename Parent work***.name?
- Next by thread: Re: Hide Code
- Index(es):