Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Spread sheet name auto fill into specificcell

0

I need to capture the document Name/worksheet name into a cell - "Not" a file Path or a file name. The specific Excel spread sheet or sheets name.

E.G. - Excell spreadsheet name = Sample 123

Sample 123 - needs to automatically be captured in Column 1 Row 2 

Note: Due to business rules the spreadsheet name cannot captured in headers and footers.

Is anyone able to give sound advice on this problem?

Answer
Discuss

Answers

0

Use this macro:

Sub get_name()

Cells(2, 1).Value = ThisWorkbook.FullName

End Sub
Discuss

Discussion

To get just the file name (not entire path) use: Cells(2, 1).Value = ThisWorkbook.Name
WillieD24 (rep: 557) Aug 22, '20 at 6:41 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login