Renaming of Worksheets from Input Data
Perhaps you can help yourself.
Sub shnm()
j = 2
For i = 2 To 6
sheets(i).Activate
msgbox "this is index " & i & vbNewline _
& "Name: " & sheets(i).Name
'Sheets(i).Name = Sheets("Master").Cells(j + 7, 2)
j = j + 2
Next i
End Sub
Run this macro and see what sheets are refered to. Change the i = 2 to 6 to
perhaps i = 4 to 8 until you get the right set of sheets. then you can
uncomment the renaming line. I have added a variable j to refer to the
cells originally refered to. I have used "Master" as the location of those
cells (that hold the new names). Change that to refer to the actual sheet
that contains the new names.
--
Regards,
Tom Ogilvy
"SYBS" wrote in message
...
Renaming of Worksheets from Input Data
Hi,
Sorry to be reposting, I' m desperate.
I have struggled on for ever it seems trying to finalise this scoring
program, and just at the last gasp - it all went haywire. Naturally.
I had a macro working (thanks to 'bj') which renamed the tabs to show data
input onto the Relevant Set Up sheet in each workbook on the sheet called
SET
UP. So as contestants names were entered the tabs changed to relate to
those
names. Since I moved them all to one workbook although everything else
works, the macro's don't
Sub shnm()
For i = 2 To 6
Sheets(i).Name = Sheets(1).Cells(I + 7, 2)
Next i
End Sub
I altered the For I = 2 To 6 to relate to the smaller range of sheet tabs
in
the other workbooks, that was fine
I added a MASTER page which is now the first sheet in the workbook where
one
of 8 options can be selected using macros based on '.visible' so when an
option is clicked on the MASTER page at start up the only tabs showing are
the selected option eg., Set Up1, 1,2,3,4,5, Results, through to '8'
Masters
is then hidden as well. This works fine.
The original renaming macro doesn't work now that the individual books are
all part of one book.
The first and last sheets did not need renaming, the middle
five/four/three/two needed to be renamed according to the input on Set Up
1/2/3/4/5/6/7/8.
The tabs looks like this.
Set Up 1, 1, 2, 3, 4, 5, Results 1
Set Up 2, 21, 22, 23, 24, 25, Results 2
Set Up 3, 31, 32, 33, 34, Results 3)
Set Up 4, 41, 42, 43, 44, Results 4
Set Up 5, 51, 52, 53, Results 5
Set Up 6, 61, 62, 63, Results 6
Set Up 7, 71, 72, Results 7
Set Up 8, 81, 82, Results 8
Is this new first sheet 'MASTERS' what's causing the problem or is it
something to do with the hidden sheets, or how many there are of them now.
I am totally desperate, can anyone out there help, please.
|