Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename a worksheet and save change

Status
Not open for further replies.
Dec 13, 2002
109
GB
Hi everyone

Does anyone know the command to rename a worksheet in an active workbook and then save the change? For example I have a workbook called "a" which is open and activated. The worksheet within is called "b" and I want to rename it "a" and save the change to the workbook.

Does this change take effect immediately if the workbook is open and active?

Thanks

Ronald
 
with Activeworkbook
.sheets("b").name = "a"
.save
end with Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
Thanks Geoff

If a worksheet has a date extension e.g "a1332003"
but I didnt know the date extension how could I reference it, i.e. the "a" portion is always constant. There would only be the single worksheet in a given workbook.

So my statement:
With ActiveWorkBook
.Sheets("a whateverdate").name = "b"
.save
end with

Does the first worksheet have a constant reference that can be used irrespective of name?


Cheers
Ronald
 
Doh!

Im being REALLY dumb now:---

With ActiveWorkBook
.ActiveSheet.Name = "b"
.Save
End With


seems to work!!!

Ronald
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top