putting file name within spreadsheet

B

bobf

Is there any way I can display the name of my Excel
spreadsheet in cell A1 of the spreadsheet?
 
D

Dave O

....Type it in?

Yes, but afaik it can only be done with some VBA code.
1. Open the VBA editor
2. Along the left margin choose the VBAProject associated with your
file
3. Right click "This workbook" and select "View Code". A new VBA
editor window opens. Dropdowns along the top should say "This
workbook" and "Open". The structure for a new routine is visible:
"Private Sub Workbook_Open()" and "End Sub".
4. Use this code:
Range("a1").value = activeworkbook.name

Each time you open the file this routine will run. If your workbook
has multiple tabs you'll need to specify which tab to write in: try
this line of code:

Sheets("YourSheetName").select

Final code looks like:
Private Sub Workbook_Open()
Sheets("YourSheetName").Select
Range("a1").Value = ActiveWorkbook.Name
End Sub
 
J

jiwolf

bobf said:
Is there any way I can display the name of my Excel
spreadsheet in cell A1 of the spreadsheet?

try: -

=MID(CELL("filename",C9538),FIND("[",CELL("filename",C9538))+1,FIND("]",CELL("filename",C9538))-FIND("[",CELL("filename",C9538))-1)
 
Top