Workbook name

G

Guest

Is there a way to copy the Workbook Name into a worksheet?

Say I had a workbook called Test Me.xls, when it is opened it will put "Test
(dont meed the "me") into cell A1?

Thank you in advance!
 
G

Guest

This formula will give you the "Test Me"

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

If you just want the first word in the filename try

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

Guest

Thank you, that does work.

How can I make this happen with a Workbook_Open() event? (I am sick of
messing with it)

Thank you once again!

daddylonglegs said:
This formula will give you the "Test Me"

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

If you just want the first word in the filename try

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



Steve said:
Is there a way to copy the Workbook Name into a worksheet?

Say I had a workbook called Test Me.xls, when it is opened it will put "Test
(dont meed the "me") into cell A1?

Thank you in advance!
 
C

Chip Pearson

Try

Private Sub Workbook_Open()
Me.Worksheets("Sheet1").Range("A1").Value = Me.Name
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

Steve said:
Thank you, that does work.

How can I make this happen with a Workbook_Open() event? (I am sick of
messing with it)

Thank you once again!

daddylonglegs said:
This formula will give you the "Test Me"

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

If you just want the first word in the filename try

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



Steve said:
Is there a way to copy the Workbook Name into a worksheet?

Say I had a workbook called Test Me.xls, when it is opened it will put
"Test
(dont meed the "me") into cell A1?

Thank you in advance!
 
G

Guest

BEAUTIMOUS!

Thank you for the help works great!

Maybe help with my next quesition about formatting? How can I format the
target cell to ignore the first X amount of charaters and the ignore the
".xls" at the end?

Thank you once again!

Chip Pearson said:
Try

Private Sub Workbook_Open()
Me.Worksheets("Sheet1").Range("A1").Value = Me.Name
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

Steve said:
Thank you, that does work.

How can I make this happen with a Workbook_Open() event? (I am sick of
messing with it)

Thank you once again!

daddylonglegs said:
This formula will give you the "Test Me"

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

If you just want the first word in the filename try

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



:

Is there a way to copy the Workbook Name into a worksheet?

Say I had a workbook called Test Me.xls, when it is opened it will put
"Test
(dont meed the "me") into cell A1?

Thank you in advance!
 
G

Guest

Thank you David and Chip, after some experimenting I did get it to work
properly.

Keep up the great work, you make it much easier for lackies like myself!

Steve
 

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