View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default Return Partial File Name to Cell

Hi Dee,

How did you do it in your VBA code? Perhaps if you post your code, others
can comment on it. But anyway, maybe try something like this:

ActiveSheet.Range("A1").Formula =
"=MID(CELL(""filename""),SEARCH(""\["",CELL(""filename""))+2,4)"

it puts your formula in cell A1 of the active sheet.

--
Hope that helps.

Vergel Adriano


"dee" wrote:

Hi,

I have the following function in my cell:

=MID(CELL("filename"),SEARCH("\[",CELL("filename"))+2,4)

This returns my invoice number, which is the first 4 characters of the file
name.

I tried to create VBA code in my Personal.xls, so that I can enter this code
into invoices more easily, but it keeps putting in the first 4 characters of
the Personal.xls file instead of the current file.

Help!

Thanks!

--
Thanks!

Dee