Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / November 2006

Tip: Looking for answers? Try searching our database.

Creating a copy of a sheet and naming it

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
brian.jermain@googlemail.com - 03 Nov 2006 20:39 GMT
Being a newbie to VBA could I please have some advice .

What I am trying to do is write a macro to select the active sheet and
create a copy of it but then I would like an input message to ask me
what to name the sheet so that I am presented with an exact copy
(including macro buttons) but with a name of my choice.  I have tried a
myriad of combinations but do not seem able to get it to work

This macro must be able to work with any selected sheet in the workbook

Any help would be appreciated

Brian
Scotland
Earl Kiosterud - 03 Nov 2006 21:27 GMT
Brian,

SheetName = InputBox("Enter desired name for copy of active sheet")
activesheet.Copy After:=ActiveSheet
ActiveSheet.Name = SheetName

It will copy the selected sheet and put it sheet after the selected sheet.
It won't check that the name entered already exists in a sheet, which will
cause an error.

As a starter, you can start the macro recorder (Tools - Macro - Record new
macro), do the biz, stop the recorder, then modify the code as needed.

Signature

Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------

> Being a newbie to VBA could I please have some advice .
>
[quoted text clipped - 10 lines]
> Brian
> Scotland
brian.jermain@googlemail.com - 03 Nov 2006 21:45 GMT
Earl

Thank you very much - you make it look so easy

Much appreciated

Brian
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.