Computing.Net > Forums > Programming > Using VB to rename Excel sheet tabs

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Using VB to rename Excel sheet tabs

Reply to Message Icon

Name: Shawn
Date: March 28, 2003 at 12:08:59 Pacific
OS: 2000
CPU/Ram: pent 4
Comment:

In Excel i want to rename the worksheet tab using a VB macro. I want it to copy a cell on the worksheet and use it as the worksheet name. It needs to be variable because i want to copy the worksheet, increment the cell value by one, and have the new worksheet named the new cell value.
Here is the code:

ActiveSheet.Copy After:=ActiveSheet

ActiveSheet.Previous.Select
Range("j3").Copy
ActiveSheet.Next.Select
Range("j3").PasteSpecial xlPasteValues
Range("j3").Value = Range("j3").Value + 1
ActiveSheet.Name = Range("j3").Value

It is the last line that is giving me trouble.

Thanks for any help.




Sponsored Link
Ads by Google

Response Number 1
Name: egkenny
Date: March 28, 2003 at 17:13:15 Pacific
Reply:

ActiveSheet.Name = Format(Range("j3").Value, "#")


0

Response Number 2
Name: shawn
Date: March 31, 2003 at 10:30:51 Pacific
Reply:

It worked perfectly, I did change the format to mm-dd-yy.

Thank you egkenny!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Using VB to rename Excel sheet tabs

VBS to Rename Files www.computing.net/answers/programming/vbs-to-rename-files/19550.html

VB:write hyperlinks to excel sheet www.computing.net/answers/programming/vbwrite-hyperlinks-to-excel-sheet/17158.html

Html link to specific Excel Sheet www.computing.net/answers/programming/html-link-to-specific-excel-sheet/1787.html