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 / June 2007

Tip: Looking for answers? Try searching our database.

Excel Macros: Creating, positioning and renaming a sheet

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
john.galt.online@gmail.com - 26 Jun 2007 13:56 GMT
I am trying to create a macro that does the following:
1- Creates a new sheet
2- Places the new sheet at the end (extreme right) all all existing
sheets
3- Reads the data written in the cell above the active cell (i.e. cell
that was active when the macro was run), and renames the new sheet to
that text string.

For instance, if
1- there are 5 existing sheets - 1,2,3,4 and 5 (in that order L to R)
2- the button to run the macro is on cell C5 of sheet 1
3- cell C4 has data "aloha"
then, if I hit the button:
a new sheet called aloha should be created to the right of sheet 5

I think the biggest problem I am running into is naming the new sheet
based on the data from a relatively referenced cell.

Please help!
Don Guillett - 26 Jun 2007 14:12 GMT
try this
Sub makeandnamesheet()
myname = ActiveCell.Offset(-1)
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = myname
End Sub

Signature

Don Guillett
SalesAid Software
dguillett1@austin.rr.com

>I am trying to create a macro that does the following:
> 1- Creates a new sheet
[quoted text clipped - 15 lines]
>
> Please help!
Bob Umlas - 26 Jun 2007 14:16 GMT
Sub Answer()
   On Error Resume Next
   If Activecell.Row=1 then Exit Sub  'can't work as described!
  NewName=Activecell.Offset(-1).Value
  Worksheets.Add After:=Sheets(Sheets.Count)
  ActiveSheet.Name=NewName
End Sub

Bob Umlas
Excel MVP

>I am trying to create a macro that does the following:
> 1- Creates a new sheet
[quoted text clipped - 15 lines]
>
> Please help!

Rate this thread:






 
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.