Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,934
Default Work sheets tab names only replace part ot the present name

I assume you want to change the actual worksheet name, correct? If so...

You didn't say whether the number in A1 is always going to be four digits
long or not; nor did you day whether the value in A2 will always be three
characters long or not. This code should work for any case...

Sub ChangeTabName()
Dim S() As String
If Range("A1").Value < "" And Range("A2").Value < "" Then
S = Split(ActiveSheet.Name, , 2)
S(0) = Range("A1").Value & "~" & Range("A1").Value
S(1) = Left(S(1), InStrRev(S(1), "code", , vbTextCompare) _
+ 3) & Range("A2").Value
ActiveSheet.Name = Join(S)
End If
End Sub

--
Rick (MVP - Excel)


"John Augustein" wrote in message ...
The work book has 23 sheets all linked to 1. I want to put the parts to
change too.
A1 = 2482
A2 = CH5

The following is a current tab name.

2481~2481 SN22 CODEGK4

I need everything to stay the same except after the change I need it to
say

2482~2482 SN22 CODECH5

Thanks in advance.
Augie

EggHeadCafe - Software Developer Portal of Choice
Review: Improving .NET Application Performance
http://www.eggheadcafe.com/tutorials...ng-net-ap.aspx


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I replace A, B, C, Column names, with my own names? Lugojanul Excel Discussion (Misc queries) 1 March 15th 07 07:46 PM
Creating Sheets in a present Xl File anil Excel Discussion (Misc queries) 2 December 11th 06 11:28 AM
List all sheets present in Workbook Jeff Excel Worksheet Functions 6 November 9th 06 09:03 PM
Replace Old Part Numbers with New Part Numbers in a Macro. Jeffery Keown Excel Discussion (Misc queries) 5 October 17th 06 03:45 PM
How can I count number of sheets present in a workbook? Imran Excel Discussion (Misc queries) 1 October 6th 06 11:06 AM


All times are GMT +1. The time now is 06:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"