Excel VBA ?

  • Thread starter Thread starter confused
  • Start date Start date
C

confused

In excel vba I want to add a line that displays the name of the workbook on a
summary sheet

Is there an automatic way to add the name without typing it in

here's what I have so far:
'Enter Name
..Range ("B1") = "NAME"

Thank you in advance !!!
 
Hi,

The first line puts the name in a cell the second one puts the full path and
name

Sheets("Sheet1").Range("A1") = ThisWorkbook.Name
Sheets("Sheet1").Range("A2") = ThisWorkbook.FullName
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
 
=CELL("Filename")

Be careful with that. If another workbook is active when Excel
calculates the formula, that will return the name of the active
workbook, not the name of the workbook containing the formula. You can
force it to use the workbook containing the formula with

=CELL("filename",A1)

It doesn't matter what cell you pass to CELL; just pass any cell that
is in the workbook whose name you want to retrieve.\


Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]
 
Back
Top