Workbook name

  • Thread starter Thread starter Guest
  • Start date Start date
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!
 
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)
 
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!
 
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!
 
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!
 
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
 
Back
Top