Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Naming a sheet



Howdie,

I need to run a macro from within a sheet (currently called data), that
does several things to the sheet, the last being to rename the sheet to
the contents of cellb2.
Whats the vb to rename a sheet to b2...?

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Naming a sheet

activesheet.name = Range("B2").Value

--
Regards,
Tom Ogilvy


"Darin Kramer" wrote in message
...


Howdie,

I need to run a macro from within a sheet (currently called data), that
does several things to the sheet, the last being to rename the sheet to
the contents of cellb2.
Whats the vb to rename a sheet to b2...?

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 325
Default Naming a sheet

Darin,

This should do - paste it into the Code module of the "Data" worksheet

Whenever you change the value in the cell with the name "TabName" (you can
replace this with a cell reference if you want), the tabname will change to
that value, renaming the worksheet accordingly.

Regards

Pete



Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False

If Target.Address = Range("TabName").Address Then
Me.Name = Format(Target.Value)
End If
ws_exit:
Application.EnableEvents = True

End Sub

"Darin Kramer" wrote:



Howdie,

I need to run a macro from within a sheet (currently called data), that
does several things to the sheet, the last being to rename the sheet to
the contents of cellb2.
Whats the vb to rename a sheet to b2...?

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Naming a sheet Mike Excel Discussion (Misc queries) 3 March 7th 07 08:43 AM
naming sheet tab artist4christ Excel Worksheet Functions 5 January 17th 07 11:54 PM
Naming Sheet mehare Excel Discussion (Misc queries) 4 August 14th 06 06:20 PM
Sheet naming Pat Excel Programming 7 December 15th 04 10:29 PM
Naming a new sheet. Rich Cooper Excel Programming 1 May 25th 04 09:56 PM


All times are GMT +1. The time now is 02:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"