Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Does anyone know of a simple way to insert the file name (less extension) as
data in a particular cell? I have data that is exported froma test grading program as comma separated data. I open it in Excel to format so it can be imported into another program. The test scoring program exports the student ID and a test score. The idea is to name the exported file as "Quiz 1.txt" then use the macro to insert "Quiz 1" as the "B:1" cell of the score column. THANKS!!! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,FIND("]",CELL("fi
lename",A1),1)-FIND("[",CELL("filename",A1),1)-5) -- HTH Bob Phillips "Jim at SDSU" <Jim at wrote in message ... Does anyone know of a simple way to insert the file name (less extension) as data in a particular cell? I have data that is exported froma test grading program as comma separated data. I open it in Excel to format so it can be imported into another program. The test scoring program exports the student ID and a test score. The idea is to name the exported file as "Quiz 1.txt" then use the macro to insert "Quiz 1" as the "B:1" cell of the score column. THANKS!!! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Look at the bottom of this page for formulas.
http://www.cpearson.com/excel/excelF.htm -- Regards, Tom Ogilvy "Jim at SDSU" <Jim at wrote in message ... Does anyone know of a simple way to insert the file name (less extension) as data in a particular cell? I have data that is exported froma test grading program as comma separated data. I open it in Excel to format so it can be imported into another program. The test scoring program exports the student ID and a test score. The idea is to name the exported file as "Quiz 1.txt" then use the macro to insert "Quiz 1" as the "B:1" cell of the score column. THANKS!!! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
THANKS, but I forgot to mention, I want this to be part of a macro that does
a lot of other stuff at the same time (e.g. reformats the Student ID, inserts the header row, inserts the Student ID title etc.) "Tom Ogilvy" wrote: Look at the bottom of this page for formulas. http://www.cpearson.com/excel/excelF.htm -- Regards, Tom Ogilvy "Jim at SDSU" <Jim at wrote in message ... Does anyone know of a simple way to insert the file name (less extension) as data in a particular cell? I have data that is exported froma test grading program as comma separated data. I open it in Excel to format so it can be imported into another program. The test scoring program exports the student ID and a test score. The idea is to name the exported file as "Quiz 1.txt" then use the macro to insert "Quiz 1" as the "B:1" cell of the score column. THANKS!!! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Range("B1").Value = left(activeworkbook.Name,len(ActiveWorkbook.name)-4)
-- Regards, Tom Ogilvy "Jim at SDSU" wrote in message ... THANKS, but I forgot to mention, I want this to be part of a macro that does a lot of other stuff at the same time (e.g. reformats the Student ID, inserts the header row, inserts the Student ID title etc.) "Tom Ogilvy" wrote: Look at the bottom of this page for formulas. http://www.cpearson.com/excel/excelF.htm -- Regards, Tom Ogilvy "Jim at SDSU" <Jim at wrote in message ... Does anyone know of a simple way to insert the file name (less extension) as data in a particular cell? I have data that is exported froma test grading program as comma separated data. I open it in Excel to format so it can be imported into another program. The test scoring program exports the student ID and a test score. The idea is to name the exported file as "Quiz 1.txt" then use the macro to insert "Quiz 1" as the "B:1" cell of the score column. THANKS!!! |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That's "almost" it. Works if I save as an XLS first, but never gives a value
if it remains a text file. "cell (filename) " would work except it is the full path instead of just the file name. I was hoping there was a VB function that just says "insert the filename without the extension as text here" I do appreciate your time though. "Tom Ogilvy" wrote: Range("B1").Value = left(activeworkbook.Name,len(ActiveWorkbook.name)-4) |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Shouldn't make any difference how you save it.
Demo'd from the Immediate window on a workbook in excel saved as text. ? activeworkbook.Name export.txt ? left(activeworkbook.Name,len(ActiveWorkbook.name)-4) export Perhaps you need to be more specific about how it doesn't work. -- regards, Tom Ogilvy "Jim at SDSU" wrote in message ... That's "almost" it. Works if I save as an XLS first, but never gives a value if it remains a text file. "cell (filename) " would work except it is the full path instead of just the file name. I was hoping there was a VB function that just says "insert the filename without the extension as text here" I do appreciate your time though. "Tom Ogilvy" wrote: Range("B1").Value = left(activeworkbook.Name,len(ActiveWorkbook.name)-4) |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Well, it was my own "DUH!!"
I was trying to insert this directly into the macro. When I declaired a function, put this into the function, and inserted the *function* into the macro IT WORKED!!! THANK YOU, THANK YOU, THANK YOU!!! "Tom Ogilvy" wrote: Range("B1").Value = left(activeworkbook.Name,len(ActiveWorkbook.name)-4) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to retrieve data from other filename? | Excel Discussion (Misc queries) | |||
Use filename in cell to link data | Excel Worksheet Functions | |||
set filename to <filename-date on open | Excel Worksheet Functions | |||
Import Data with the filename coming from inputbox ? | Excel Programming | |||
Saving filename same as import filename | Excel Programming |