Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 21
Default macro to grab current workbook filename

Excel 2003:
I need a macro that grabs the current workbook filename and drops it into
cell A2. I know this is simple, but my head is fried this evening....


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,441
Default macro to grab current workbook filename

TR,

We need a better description of "cell A2"- what sheet?, what workbook?, etc,
but something like this might get you started:

Sub TRYoung()
ThisWorkbook.Sheets("Sheetname").Range("A2").Value = Activeworkbook.FullName
End Sub


HTH,
Bernie
MS Excel MVP


"TR Young" wrote in message
...
Excel 2003:
I need a macro that grabs the current workbook filename and drops it into
cell A2. I know this is simple, but my head is fried this evening....


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default macro to grab current workbook filename

Do you want a macro?

You don't "need" one.

Simple worksheet function can return filename to a cell.

See Bob Phillips' site for various permutations.

http://www.xldynamic.com/source/xld.xlFAQ0002.html


Gord Dibben MS Excel MVP

On Thu, 11 Jun 2009 16:18:32 -0400, "TR Young"
wrote:

Excel 2003:
I need a macro that grabs the current workbook filename and drops it into
cell A2. I know this is simple, but my head is fried this evening....


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,276
Default macro to grab current workbook filename

Hi,
In cell A2 enter

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

If this helps please click yes, thanks

"TR Young" wrote:

Excel 2003:
I need a macro that grabs the current workbook filename and drops it into
cell A2. I know this is simple, but my head is fried this evening....



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
Function to insert current filename into worksheet? Ginko Excel Worksheet Functions 2 May 7th 08 12:32 PM
Enter current date automatically in filename Megadrone Excel Worksheet Functions 1 January 25th 07 03:48 PM
save workbook as current date using a macro ExcelJon Excel Discussion (Misc queries) 2 June 21st 06 03:05 AM
Create buttom that saves current file in a given filename (Excel) mamealemka Excel Worksheet Functions 3 March 17th 06 12:02 PM
I want a cell to show the current filename automatically. Troy Excel Discussion (Misc queries) 4 January 31st 06 02:32 PM


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