Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How to set up a worksheet name as file name

I want worksheet name to be auto change when I change the file name
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 360
Default How to set up a worksheet name as file name

In the ThisWorkbook module:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ActiveSheet.Name = Me.Name 'refer to your sheet if it's not the active
sheet
End Sub

Sheet names are limited to 31 characters, so you may want to do
something like this:

If Len(Me.Name) 31 Then ActiveSheet.Name = Left(Right(Me.Name,
35), 31)

Cliff Edwards
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
Worksheet to new file jai Excel Discussion (Misc queries) 1 August 25th 07 07:36 AM
Worksheet to new file jai Excel Discussion (Misc queries) 2 August 24th 07 10:12 PM
copy part of a worksheet into a worksheet in the same file/keepi. JTB Excel Worksheet Functions 1 September 23rd 06 09:13 AM
Saving worksheet in new file with date AND cell value as file name michaelberrier Excel Discussion (Misc queries) 4 May 26th 06 08:05 PM
How to get file name on a worksheet? UNNI New Users to Excel 2 February 15th 06 10:09 AM


All times are GMT +1. The time now is 08:16 PM.

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

About Us

"It's about Microsoft Excel"