View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Changing name of worksheet based on data in cell of another worksheet

used his keyboard to write :
On Apr 21, 3:49*am, Paul Robinson
wrote:
Hi
You have put the code in the wrong place (re-read my original
reply:)). The worksheet module is for special kinds of procedures
called worksheet level procedures and respond to certain things you do
to the worksheet. You need to put the code into what is called a
general code module. In the VBE go to Insert on the toolbar then click
on Module. You will get a blank white screen. Paste the code into
there (and delete it from the worksheet module!).
regards
Paul
On Apr 20, 9:19*pm, " wrote:



Paul,


Thanks for the quick response. *I copied the code you replied with
into the VBA editor and place it on the Master Sheet object. *I saved
and then started to enter lastnames from B13 to B30. *The names of the
Stud1 - Stud18 worksheets didn't change. *Was there a part of your
code that I needed to edit or customize for my workbook? *Oh, I am
using Excel 2007. *Any suggestions?- Hide quoted text -


- Show quoted text -


Gentlemen,

I moved the code into it's own module and saved the workbook.
I then ran the Macro and recieved a "run-time error '9' Subscript out
of range"
I hit the "Debug" option and the VBE had the following line of code
highlighted:

Worksheets(Temp).Name = mycell.Value

Is there something wrong? Again I appreciate all the help everyone
has put forth!

Brad


I forgot to include...

Are there 18 worksheets named "Stud1" through "Stud18"?

--
Garry

Free usenet access at
http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc