macro to grab current workbook filename

T

TR Young

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....
 
B

Bernie Deitrick

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
 
E

Eduardo

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top