PC Review


Reply
Thread Tools Rate Thread

Cell formula that captures name of the file's folder

 
 
=?Utf-8?B?a2x5c2VsbA==?=
Guest
Posts: n/a
 
      22nd Jun 2007
Hi,

How does one capture the folder name in which a file resides? I want to
ensure that the folder name (in this case a date) is always indicated in a
cell in a spreadsheet. I could always use a pop-up calendar that the user can
enact, but I want to force this date cell to always have the correct date
(not necessarily the current date), and this date will be the name of the
folder (e.g. "F0607_5FEB").

Thanks in advance,
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: 613.948-9557
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      22nd Jun 2007
Formulas at the bottom of this page

http://www.cpearson.com/excel/excelF.htm#SheetName

--
Regards,
Tom Ogilvy


"klysell" wrote:

> Hi,
>
> How does one capture the folder name in which a file resides? I want to
> ensure that the folder name (in this case a date) is always indicated in a
> cell in a spreadsheet. I could always use a pop-up calendar that the user can
> enact, but I want to force this date cell to always have the correct date
> (not necessarily the current date), and this date will be the name of the
> folder (e.g. "F0607_5FEB").
>
> Thanks in advance,
> --
> Kent Lysell
> Financial Consultant
> Ottawa, Ontario
> W: 613.948-9557

 
Reply With Quote
 
=?Utf-8?B?a2x5c2VsbA==?=
Guest
Posts: n/a
 
      22nd Jun 2007
Thanks Tom. These formulas are interesting, but they don't return the
"foldername", just the filename or the full path. How would I adapt this
formula to return the foldername in which the filename resides?

Thanks.
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: 613.948-9557


"Tom Ogilvy" wrote:

> Formulas at the bottom of this page
>
> http://www.cpearson.com/excel/excelF.htm#SheetName
>
> --
> Regards,
> Tom Ogilvy
>
>
> "klysell" wrote:
>
> > Hi,
> >
> > How does one capture the folder name in which a file resides? I want to
> > ensure that the folder name (in this case a date) is always indicated in a
> > cell in a spreadsheet. I could always use a pop-up calendar that the user can
> > enact, but I want to force this date cell to always have the correct date
> > (not necessarily the current date), and this date will be the name of the
> > folder (e.g. "F0607_5FEB").
> >
> > Thanks in advance,
> > --
> > Kent Lysell
> > Financial Consultant
> > Ottawa, Ontario
> > W: 613.948-9557

 
Reply With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      22nd Jun 2007
not sure what you're looking for, if the folder already exists or if you're
trying to create one.

this may give you the folder from which the workbook was opened.

Option Explicit
Sub test()
Dim fp As String
Dim fp2 As Variant
fp = ThisWorkbook.Path

fp2 = Split(fp, "\")
MsgBox fp2(UBound(fp2))
End Sub


--


Gary


"klysell" <(E-Mail Removed).(donotspam)> wrote in message
news:C73DFA88-85BA-441E-8D10-(E-Mail Removed)...
> Hi,
>
> How does one capture the folder name in which a file resides? I want to
> ensure that the folder name (in this case a date) is always indicated in a
> cell in a spreadsheet. I could always use a pop-up calendar that the user can
> enact, but I want to force this date cell to always have the correct date
> (not necessarily the current date), and this date will be the name of the
> folder (e.g. "F0607_5FEB").
>
> Thanks in advance,
> --
> Kent Lysell
> Financial Consultant
> Ottawa, Ontario
> W: 613.948-9557



 
Reply With Quote
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      22nd Jun 2007
based on the example you gave, i assumed by folder name that you meant the
tab name of the sheet. Nonetheless, you would just modify the formula to
get the folder name that the current file is saved in.

if the the cells("filename",A1) returns:

C:\AAAA_TOA\Toa_phase1\[Avenger_Stinger_DM.xls]Summary

then
=LEFT(CELL("filename",A1),FIND("[",CELL("Filename",A1))-1)

returns the path
C:\AAAA_TOA\Toa_phase1\

--
Regards,
Tom Ogilvy




"klysell" wrote:

> Thanks Tom. These formulas are interesting, but they don't return the
> "foldername", just the filename or the full path. How would I adapt this
> formula to return the foldername in which the filename resides?
>
> Thanks.
> --
> Kent Lysell
> Financial Consultant
> Ottawa, Ontario
> W: 613.948-9557
>
>
> "Tom Ogilvy" wrote:
>
> > Formulas at the bottom of this page
> >
> > http://www.cpearson.com/excel/excelF.htm#SheetName
> >
> > --
> > Regards,
> > Tom Ogilvy
> >
> >
> > "klysell" wrote:
> >
> > > Hi,
> > >
> > > How does one capture the folder name in which a file resides? I want to
> > > ensure that the folder name (in this case a date) is always indicated in a
> > > cell in a spreadsheet. I could always use a pop-up calendar that the user can
> > > enact, but I want to force this date cell to always have the correct date
> > > (not necessarily the current date), and this date will be the name of the
> > > folder (e.g. "F0607_5FEB").
> > >
> > > Thanks in advance,
> > > --
> > > Kent Lysell
> > > Financial Consultant
> > > Ottawa, Ontario
> > > W: 613.948-9557

 
Reply With Quote
 
=?Utf-8?B?a2x5c2VsbA==?=
Guest
Posts: n/a
 
      22nd Jun 2007
Thanks. I decided to go another route.
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: 613.948-9557


"Tom Ogilvy" wrote:

> based on the example you gave, i assumed by folder name that you meant the
> tab name of the sheet. Nonetheless, you would just modify the formula to
> get the folder name that the current file is saved in.
>
> if the the cells("filename",A1) returns:
>
> C:\AAAA_TOA\Toa_phase1\[Avenger_Stinger_DM.xls]Summary
>
> then
> =LEFT(CELL("filename",A1),FIND("[",CELL("Filename",A1))-1)
>
> returns the path
> C:\AAAA_TOA\Toa_phase1\
>
> --
> Regards,
> Tom Ogilvy
>
>
>
>
> "klysell" wrote:
>
> > Thanks Tom. These formulas are interesting, but they don't return the
> > "foldername", just the filename or the full path. How would I adapt this
> > formula to return the foldername in which the filename resides?
> >
> > Thanks.
> > --
> > Kent Lysell
> > Financial Consultant
> > Ottawa, Ontario
> > W: 613.948-9557
> >
> >
> > "Tom Ogilvy" wrote:
> >
> > > Formulas at the bottom of this page
> > >
> > > http://www.cpearson.com/excel/excelF.htm#SheetName
> > >
> > > --
> > > Regards,
> > > Tom Ogilvy
> > >
> > >
> > > "klysell" wrote:
> > >
> > > > Hi,
> > > >
> > > > How does one capture the folder name in which a file resides? I want to
> > > > ensure that the folder name (in this case a date) is always indicated in a
> > > > cell in a spreadsheet. I could always use a pop-up calendar that the user can
> > > > enact, but I want to force this date cell to always have the correct date
> > > > (not necessarily the current date), and this date will be the name of the
> > > > folder (e.g. "F0607_5FEB").
> > > >
> > > > Thanks in advance,
> > > > --
> > > > Kent Lysell
> > > > Financial Consultant
> > > > Ottawa, Ontario
> > > > W: 613.948-9557

 
Reply With Quote
 
=?Utf-8?B?a2x5c2VsbA==?=
Guest
Posts: n/a
 
      22nd Jun 2007
Thanks Gary.
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: 613.948-9557


"Gary Keramidas" wrote:

> not sure what you're looking for, if the folder already exists or if you're
> trying to create one.
>
> this may give you the folder from which the workbook was opened.
>
> Option Explicit
> Sub test()
> Dim fp As String
> Dim fp2 As Variant
> fp = ThisWorkbook.Path
>
> fp2 = Split(fp, "\")
> MsgBox fp2(UBound(fp2))
> End Sub
>
>
> --
>
>
> Gary
>
>
> "klysell" <(E-Mail Removed).(donotspam)> wrote in message
> news:C73DFA88-85BA-441E-8D10-(E-Mail Removed)...
> > Hi,
> >
> > How does one capture the folder name in which a file resides? I want to
> > ensure that the folder name (in this case a date) is always indicated in a
> > cell in a spreadsheet. I could always use a pop-up calendar that the user can
> > enact, but I want to force this date cell to always have the correct date
> > (not necessarily the current date), and this date will be the name of the
> > folder (e.g. "F0607_5FEB").
> >
> > Thanks in advance,
> > --
> > Kent Lysell
> > Financial Consultant
> > Ottawa, Ontario
> > W: 613.948-9557

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula for cell reference in another file MPH Microsoft Excel Discussion 7 24th Mar 2006 12:09 AM
What formula captures specified rows of data? =?Utf-8?B?QnJpYW4gRyBTY3VsbHk=?= Microsoft Excel Worksheet Functions 3 28th Nov 2005 02:14 PM
how to keep formula don't changed when I copy the file the folder =?Utf-8?B?bWlhbyBqaWU=?= Microsoft Excel Misc 1 1st Nov 2004 03:37 AM
how to keep formula un-changed when I chage to file folder? =?Utf-8?B?bWlhbyBqaWU=?= Microsoft Excel Programming 1 1st Nov 2004 03:36 AM
Formula that captures criteria from 2 different columns "Help ME" poloxstar Microsoft Excel Programming 1 26th May 2004 05:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:12 PM.