Naming work sheet the name as sub-routine that creates it

R

Rich Mogy

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
 
J

JP

This might not be terribly helpful, but you can give a worksheet any
name you want, provided it is <= 26 characters (which I believe is the
limit for the sheet tab).

--JP
 
D

Don Guillett

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top