View Single Post
  #23   Report Post  
Posted to microsoft.public.excel.programming
Clif McIrvin[_3_] Clif McIrvin[_3_] is offline
external usenet poster
 
Posts: 203
Default Changing name of worksheet based on data in cell of another worksheet

"GS" wrote in message
...
Clif McIrvin formulated the question :
"GS" wrote in message
...
presented the following explanation :
On Apr 21, 12:02 pm, GS wrote:
was thinking very hard :

[ ]

Sub ChangeTabNames2()
Dim rng As Range, sTemp As String, i As Integer
Application.ScreenUpdating = False
For Each rng In Worksheets("Sheet1").Range("B13:B30")
i = i + 1: sTemp = "Stud" & i
Sheets(sTemp).Name = sTemp & rng.Value
Next rng
End Sub

Does work, but appends the end of the name giving me a worksheet
name
that looks like "Stud1Jones". Regardless it is working now. I
want
to thank all of you for your help.


Oh, is there a way to undo it
without having to manually change the worksheet names back to Stud1
through Stud18?


If the master sheet is always the first sheet, and there are always
18 student sheets, this should rename the student sheets as Stud1
through Stud18:

Sub ChangeTabNames3()
Dim sTemp As String, i As Integer
Application.ScreenUpdating = False
For i = 1 To 18
sTemp = "Stud" & i
Sheets(i + 1).Name = sTemp
Next i
End Sub


Clif,
I think he's got it working if he catches up to the replies. Not sure
how he's accessing this NG but he posted the same problem AFTER I
posted corrected code.


Yeah, I caught that. I posted to answer the second part of his question
.... the "undo" part.

Looks like he's using Google groups; I don't know how reliably gg
threads current discussions.

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)