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

Hi,

I need to have the file name in the excel sheet,can anyone give me some
instruction or codes that can do this.

Thanks,


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Having file name on the excel sheet automatically


ThisWorkbook.Worksheets(1).Name = ThisWorkbook.Name

If you want to have it happen automatically on opening the workbook, you
could put it in the Workbook_Open event. Paste this code into the
ThisWorkbook module in the VBE:

Private Sub Workbook_Open()
ThisWorkbook.Worksheets(1).Name = ThisWorkbook.Name
End Sub

hth,

Doug Glancy

"A-DESIGN" wrote in message
...
Hi,

I need to have the file name in the excel sheet,can anyone give me some
instruction or codes that can do this.

Thanks,




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Having file name on the excel sheet automatically

See the formulas at the bottom of Chip Pearson's page:

http://www.cpearson.com/excel/excelF.htm

these formulas require that the workbook have been saved at least once
before they will word - so putting them in the default Book1 would not work
(until it had been saved).

--
Regards,
Tom Ogilvy


"A-DESIGN" wrote in message
...
Hi,

I need to have the file name in the excel sheet,can anyone give me some
instruction or codes that can do this.

Thanks,




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Having file name on the excel sheet automatically

Woops, forgot to stop and read before I answered!

Doug

"Doug Glancy" wrote in message
...

ThisWorkbook.Worksheets(1).Name = ThisWorkbook.Name

If you want to have it happen automatically on opening the workbook, you
could put it in the Workbook_Open event. Paste this code into the
ThisWorkbook module in the VBE:

Private Sub Workbook_Open()
ThisWorkbook.Worksheets(1).Name = ThisWorkbook.Name
End Sub

hth,

Doug Glancy

"A-DESIGN" wrote in message
...
Hi,

I need to have the file name in the excel sheet,can anyone give me some
instruction or codes that can do this.

Thanks,






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Having file name on the excel sheet automatically

Thanks for all replies but I need the file name to be written in one cell
inside the sheet and not to be as a name for the worksheet, also I need it
to be updated automatically when I do save as or rename the file.

Thanks
Afshin



"Tom Ogilvy" wrote in message
...
See the formulas at the bottom of Chip Pearson's page:

http://www.cpearson.com/excel/excelF.htm

these formulas require that the workbook have been saved at least once
before they will word - so putting them in the default Book1 would not
work
(until it had been saved).

--
Regards,
Tom Ogilvy


"A-DESIGN" wrote in message
...
Hi,

I need to have the file name in the excel sheet,can anyone give me some
instruction or codes that can do this.

Thanks,








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Having file name on the excel sheet automatically

Afshin,

The formulas at Chip Pearon's page that Tom suggested will do just what you
want, e.g.,

To return the file name without the path, use
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",
CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)

hth,

Doug Glancy

"A-DESIGN" wrote in message
...
Thanks for all replies but I need the file name to be written in one cell
inside the sheet and not to be as a name for the worksheet, also I need it
to be updated automatically when I do save as or rename the file.

Thanks
Afshin



"Tom Ogilvy" wrote in message
...
See the formulas at the bottom of Chip Pearson's page:

http://www.cpearson.com/excel/excelF.htm

these formulas require that the workbook have been saved at least once
before they will word - so putting them in the default Book1 would not
work
(until it had been saved).

--
Regards,
Tom Ogilvy


"A-DESIGN" wrote in message
...
Hi,

I need to have the file name in the excel sheet,can anyone give me some
instruction or codes that can do this.

Thanks,








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Having file name on the excel sheet automatically

Okay,Thank you very much

"Doug Glancy" wrote in message
...
Afshin,

The formulas at Chip Pearon's page that Tom suggested will do just what
you
want, e.g.,

To return the file name without the path, use
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",
CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)

hth,

Doug Glancy

"A-DESIGN" wrote in message
...
Thanks for all replies but I need the file name to be written in one cell
inside the sheet and not to be as a name for the worksheet, also I need
it
to be updated automatically when I do save as or rename the file.

Thanks
Afshin



"Tom Ogilvy" wrote in message
...
See the formulas at the bottom of Chip Pearson's page:

http://www.cpearson.com/excel/excelF.htm

these formulas require that the workbook have been saved at least once
before they will word - so putting them in the default Book1 would not
work
(until it had been saved).

--
Regards,
Tom Ogilvy


"A-DESIGN" wrote in message
...
Hi,

I need to have the file name in the excel sheet,can anyone give me
some
instruction or codes that can do this.

Thanks,










  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Having file name on the excel sheet automatically

Is it possible to hide the extention of the file ?


"A-DESIGN" wrote in message
...
Okay,Thank you very much

"Doug Glancy" wrote in message
...
Afshin,

The formulas at Chip Pearon's page that Tom suggested will do just what
you
want, e.g.,

To return the file name without the path, use
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",
CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)

hth,

Doug Glancy

"A-DESIGN" wrote in message
...
Thanks for all replies but I need the file name to be written in one
cell
inside the sheet and not to be as a name for the worksheet, also I need
it
to be updated automatically when I do save as or rename the file.

Thanks
Afshin



"Tom Ogilvy" wrote in message
...
See the formulas at the bottom of Chip Pearson's page:

http://www.cpearson.com/excel/excelF.htm

these formulas require that the workbook have been saved at least once
before they will word - so putting them in the default Book1 would
not
work
(until it had been saved).

--
Regards,
Tom Ogilvy


"A-DESIGN" wrote in message
...
Hi,

I need to have the file name in the excel sheet,can anyone give me
some
instruction or codes that can do this.

Thanks,












  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Having file name on the excel sheet automatically

Afshin,

I think this will do it:

hth,

Doug Glancy

=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND(".",
CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)
"A-DESIGN" wrote in message
...
Is it possible to hide the extention of the file ?


"A-DESIGN" wrote in message
...
Okay,Thank you very much

"Doug Glancy" wrote in message
...
Afshin,

The formulas at Chip Pearon's page that Tom suggested will do just what
you
want, e.g.,

To return the file name without the path, use
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",
CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)

hth,

Doug Glancy

"A-DESIGN" wrote in message
...
Thanks for all replies but I need the file name to be written in one
cell
inside the sheet and not to be as a name for the worksheet, also I

need
it
to be updated automatically when I do save as or rename the file.

Thanks
Afshin



"Tom Ogilvy" wrote in message
...
See the formulas at the bottom of Chip Pearson's page:

http://www.cpearson.com/excel/excelF.htm

these formulas require that the workbook have been saved at least

once
before they will word - so putting them in the default Book1 would
not
work
(until it had been saved).

--
Regards,
Tom Ogilvy


"A-DESIGN" wrote in message
...
Hi,

I need to have the file name in the excel sheet,can anyone give me
some
instruction or codes that can do this.

Thanks,














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
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
Need a to automatically create a new excel from every sheet benny Excel Discussion (Misc queries) 1 January 28th 08 10:35 PM
Is there a way to have a excel automatically alphabetize a sheet? Mzinsser Excel Discussion (Misc queries) 2 September 18th 06 05:13 PM
Updating excel sheet with selected data from another sheet in the same file gsnivas Excel Worksheet Functions 1 August 4th 05 09:55 AM
in excel, how do i set up a spread sheet that automatically total. jgus New Users to Excel 1 January 14th 05 04:10 AM


All times are GMT +1. The time now is 03:31 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"