![]() |
Add file name somewhere in worksheet?
Hi. I have a folder of files that I am consolidating into 1 file 1, sheet.
When I consolidate into 1 file, can I append each row with the file name? Each file is a template, so it has the same # of columns but may have different # of rows. So, for instance, I'd like to put the name of the file in column Z of each populated row, so when it consolidates into the single file, I see the file name for each and every line. Any ideas? Thank you! |
Add file name somewhere in worksheet?
-FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls) *.xls", _ MultiSelect:=True) If IsArray(FName) Then Application.ScreenUpdating = False Set globalbook = ThisWorkbook globalbook.Worksheets("sheet").Columns("A:Y").Clea r For N = LBound(FName) To UBound(FName) *globalbook.Worksheets("sheet").Cells(rnum, "A").Value insertbook.Name* ...- is a part of a code i used for equal exampl -- Zur ----------------------------------------------------------------------- Zurn's Profile: http://www.excelforum.com/member.php...fo&userid=1464 View this thread: http://www.excelforum.com/showthread.php?threadid=26420 |
Add file name somewhere in worksheet?
Hi, Would you please give me an example for how to use your code? For instance, if I have a folder "c:\test" with these files c:\test\file1, c:\test\file2, c:\test\file3,c:\test\file4,.. c:\test\file100" in it. Each file only has one sheet named "sheet1" and each worksheet contains 4 columns and various numbers of rows Column names are A, B, C, D respectively. Would you please be so kin to tell me how to implement your code to this example? Do I have to have VB running on my computer or can I just open one o these files to use the VB Macro Editor to run the application? Any help would be dearly appreciated. Thank you. Susa -- oasi ----------------------------------------------------------------------- oasis's Profile: http://www.excelforum.com/member.php...fo&userid=2599 View this thread: http://www.excelforum.com/showthread.php?threadid=26420 |
All times are GMT +1. The time now is 05:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com