Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default name the sheet the same as the file name


Thanks to everyone who has been helping me with my macro.
I have another question.
I need the sheet to have the same name as the file name. I got it to
work by using an input box, where the user has to enter the file name.
I would like to avoid having to use the input box, and have the macro
do it automatically. Is there any way to do that? I am using Excel
2003.

Thanks, Carol
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default name the sheet the same as the file name

hi
sheet1.name = activeworkbook.name
or
activesheet.name = activeworkbook.name

regards
FSt1

"jjnotme" wrote:


Thanks to everyone who has been helping me with my macro.
I have another question.
I need the sheet to have the same name as the file name. I got it to
work by using an input box, where the user has to enter the file name.
I would like to avoid having to use the input box, and have the macro
do it automatically. Is there any way to do that? I am using Excel
2003.

Thanks, Carol

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default name the sheet the same as the file name

"jjnotme" wrote in message
...

Thanks to everyone who has been helping me with my macro.
I have another question.
I need the sheet to have the same name as the file name. I got it to
work by using an input box, where the user has to enter the file name.
I would like to avoid having to use the input box, and have the macro
do it automatically. Is there any way to do that? I am using Excel
2003.

Thanks, Carol


In general, filenames might be too long, or contain characters not allowed
in sheet names.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default name the sheet the same as the file name

Sheet names are limited to 31 characters (through xl 2003 afaik). You
could try something like this...

ActiveSheet.Name = Left(ThisWorkbook.Name, 31) 'or right as far as
that goes

Cliff Edwards
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default name the sheet the same as the file name

"ward376" wrote in message
...
Sheet names are limited to 31 characters (through xl 2003 afaik). You
could try something like this...

ActiveSheet.Name = Left(ThisWorkbook.Name, 31) 'or right as far as
that goes


That raises the issue of uniqueness of sheet names as the leading/trailing
31 characters might be the same for more than one file.
Also, my recollection is that there are characters allowed in filenames that
are not allowed in sheetnames.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default name the sheet the same as the file name

Yes it does raise the issue of duplicate sheet names. And there are
characters allowed/not allowed for file and sheet names, but more are
allowed for sheet names than file names.

* . " / \ [ ] : ; | = , not allowed in filenames (dot not allowed at
end)

: / \ ? * [ ] not allowed in sheet names

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
Why does a Multi-sheet/user file open on sheet two every time? Frustrated in NJ Excel Discussion (Misc queries) 1 January 22nd 10 05:46 PM
Split text file into Excel sheet and separate the final results intoa new sheet Luciano Paulino da Silva Excel Worksheet Functions 8 April 18th 09 02:00 AM
copy the same raws of all sheets from about a 100 file to a new sheet of a book and save the file [email protected] Setting up and Configuration of Excel 0 March 14th 07 02:13 AM
Lookup on a sheet so that every time when file open it copes data from another file sheet Anna Excel Programming 1 December 19th 06 02:02 AM
Updating excel sheet with selected data from another sheet in the same file gsnivas Excel Worksheet Functions 1 August 4th 05 09:55 AM


All times are GMT +1. The time now is 04:24 AM.

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"