View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Naming work sheet the name as sub-routine that creates it

Don,

I've listed all the procedures in a module using info from here.

http://www.cpearson.com/excel/vbe.aspx

But I think your way is far easier to do.

Barb Reinhardt


"Don Guillett" wrote:

I have never tried to determine the name of a sub being fired. You say
several. ?? Why not make a list with a for each item in the list create the
sheet and name it for the item. ONE sub.
sub dd()
Sheets.Add
ActiveSheet.Name = "dd"
end sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Rich Mogy" wrote in message
...
I have a macro that I'm trying to create several work sheets, and then put
information retrieved from a SQL database. I would like the name of each
worksheet to be the same as the sub routine that created it. Is this
possible through the code --

sub myworksheet
worksheets.add
worksheets.name(x) where x is the name of the sub
end sub

Thanks in advance.

Rich Mogy