#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default Excel VBA ?

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 !!!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Excel VBA ?

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.


"confused" wrote:

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 !!!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Excel VBA ?

=CELL("Filename")
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"confused" wrote:

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 !!!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Excel VBA ?

=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]



On Fri, 12 Mar 2010 13:00:01 -0800, Gary Brown
wrote:

=CELL("Filename")

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"