Inserting a Filename
I need to write a macro that will consolidate data from a bunch of different
files, but the files are pretty badly formatted, so I want to insert the original filename into an extra column before I copy the data out of the spreadsheet and paste it into the new, large spreadsheet. I was going to just use the Cell function to get the filename, then paste values so it didn't change when I pasted them into the new spreadsheet, but that produces errors in my code. Any suggestions? |
Inserting a Filename
I'm not exactly sure what your question is, but you can insert the file name
into a cell with code like Range("A1").Value = ActiveWorkbook.FullName -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) "AlwaysFroosh!" wrote in message ... I need to write a macro that will consolidate data from a bunch of different files, but the files are pretty badly formatted, so I want to insert the original filename into an extra column before I copy the data out of the spreadsheet and paste it into the new, large spreadsheet. I was going to just use the Cell function to get the filename, then paste values so it didn't change when I pasted them into the new spreadsheet, but that produces errors in my code. Any suggestions? |
Inserting a Filename
Yeah, not worded the best, but you got the answer perfect! That's exactly
what I was looking for. Thanks! "Chip Pearson" wrote: I'm not exactly sure what your question is, but you can insert the file name into a cell with code like Range("A1").Value = ActiveWorkbook.FullName -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com (email address is on the web site) "AlwaysFroosh!" wrote in message ... I need to write a macro that will consolidate data from a bunch of different files, but the files are pretty badly formatted, so I want to insert the original filename into an extra column before I copy the data out of the spreadsheet and paste it into the new, large spreadsheet. I was going to just use the Cell function to get the filename, then paste values so it didn't change when I pasted them into the new spreadsheet, but that produces errors in my code. Any suggestions? |
Inserting a Filename
This was great..
Thanks !! Boss "AlwaysFroosh!" wrote: I need to write a macro that will consolidate data from a bunch of different files, but the files are pretty badly formatted, so I want to insert the original filename into an extra column before I copy the data out of the spreadsheet and paste it into the new, large spreadsheet. I was going to just use the Cell function to get the filename, then paste values so it didn't change when I pasted them into the new spreadsheet, but that produces errors in my code. Any suggestions? |
All times are GMT +1. The time now is 05:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com