Want Cell A1 equal to File name + Worksheet name

  • Thread starter Thread starter Lawrence
  • Start date Start date
If you are looking for a macro try this. Launch VBE using Alt + F11. From the
left tree view double click 'This Workbook' and paste the below code. Get
back to workbook. The below code will write the bookname and sheet name to
cell A1 on Save....

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Range("A1") = "[" & ThisWorkbook.Name & "]" & ThisWorkbook.ActiveSheet.Name
End Sub
 
If you are looking for a macro try this. Launch VBE using Alt + F11. From the
left tree view double click 'This Workbook' and paste the below code. Get
back to workbook. The below code will write the bookname and sheet name to
cell A1 on Save....

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Range("A1") = "[" & ThisWorkbook.Name & "]" & ThisWorkbook.ActiveSheet.Name
End Sub
 
Using a formula, you can try this provided the workbook is already saved.

=SUBSTITUTE(CELL("filename"),INFO("directory"),)

If this post helps click Yes
 
Using a formula, you can try this provided the workbook is already saved.

=SUBSTITUTE(CELL("filename"),INFO("directory"),)

If this post helps click Yes
 
Try this formula in A1:
=CELL("filename",A1)
Regards,
Stefi

„Lawrence†ezt írta:
 
Try this formula in A1:
=CELL("filename",A1)
Regards,
Stefi

„Lawrence†ezt írta:
 
You are welcome! Thanks for the feedback!
Clicking the YES button will be appreciated.
Post if you can tell us what form would be nicer for xou!
Stefi

„Lawrence†ezt írta:
 
You are welcome! Thanks for the feedback!
Clicking the YES button will be appreciated.
Post if you can tell us what form would be nicer for xou!
Stefi

„Lawrence†ezt írta:
 

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

Back
Top