Is it possible to change excel filename from a specific excel file?
For example, create a cell that will store filename, which will depend on some other cell. If I change original cell, it should rename some third file, and set its name to a cell's content.
I don't want to use any other language, to create a script or something similar.
A formula in a cell cannot change the name of a file, regardless of whether it's the current file or a different file. To achieve what you describe you will definitely need "a script or something similar".
Don't shoot the messenger. This answers your question as stated.
Related
I have an .xltm template spreadsheet that I'm wondering if I can get a macro to populate the "save as" file name based on cell data, is this possible?
There are over 7 people who will have this spreadsheet, it's more of a form, and we are trying to figure out a way to keep the filenames uniform. I know there is the ThisWorkbook.BeforeSave, but I'm not really having any luck there. I just need it to make a file named something like $A$1 R $B$1 T $B$3.xlsx
how ever the problem im having is that one of the celss will have a function "Today()" and sometimes it will be a regular text the picture I included is off code that doeas work but only if the cell have a regular text in them but not a function, I quess it is due to it being a string or variable or something.
enter image description here
Any ideas on how to do this? anything helps thank very much.
I see from the image that you are working with Mac OS. The thing that comes to mind immediately is that the forward-slash character (/) is not allowed in a file name in Mac OS and by default, TODAY() is going to include the forward-slash character. Try using the replace function to switch it out for an underscore (_). So if your cell B7 uses the TODAY() function replace it with:
replace(range("B7").value,"/","_")
It also seems a bit strange to save an .xltm template as .xls file. Be sure you understand the workbook.saveas method including the fileformat argument
I think that part of your code should be:
ActiveWorkbook.saveAs strPath, xlExcel8
I have n excel files with the same layout, and i want to create a recap file where some info is reported for each file. The info is located in the same specific cells, for example d2 and e2 in every file.
What is the best way to do it? The file names vary without logic and that people that access that file have no skills in coding and macro, so i try to develop something very simple.
I also have no skill in database, but i have managed to create a query with every file in the folder, i have then created a column with the data but i am not able to say that i only want a specific cell, is there a way to do it?
here is a picture of the situation
A formula using INDIRECT can be used, but it will generate a #REF error when the workbook is closed. you could use your macro to open the relevant workbook, and then close it after saving the values
the indirect formula would look something like this:
=INDIRECT("'[Test File.xlxs]Test Data'!$A$7")
or, as a formula using your data:
=INDIRECT("[" & B1 & "]YourSheet!$E$2")
I want to get values from different excel files (say, File-AAA.xlsx, File-ABC.xlsx, etc). ¿How can I reference said files without inputting manually the "ABC" part of the filename, but getting it from the current sheet instead?
In the example, from our current sheet we want to get the values of A1 and A2, from the File-ABC.xlsx file, and sum them.
For instance, in B2, instead of writing:
=SUM('\\server\path\[File-ABC.xlsx]Data'!A1:A2)
I would like to be able to write it as
=SUM('\\server\path\[File-*REFERENCE TO CELL*.xlsx]Data'!A1:A2)
Where *REFERENCE TO CELL* is the sought text string that references the cell that contains "ABC" (A2).
You can use the indirect function for this.
Something like this -
=SUM(INDIRECT("'\\server\path\[File-"&A2&".xlsx]Data'!A1"&":"&"A2"))
Edit-1 :
You can use the same syntax to refer to the local directory that you want, just replace \server\path[File- with the path of the new directory. You can copy the path from your file explorer after browsing to the concerned folder.
Eg. Taking the path from your comment (after correction):
=SUM(INDIRECT("'C:\Users\PeteThePanda\Spreadsheets[File-"&A3&".xlsx]Data'!A1"&":"&"A2"))
A more straightforward way to do this is set up a conditional statement outside the sum, e.g. if the value of A2 in the current workbook is ABC, then go to this path and bring in the sum.
e.g.
=if(A2="ABC",sum('\\server\path\[File-ABC.xlsx]Data'!A1:A2),if(A2="AAA", sum('\\server\path\[File-AAA.xlsx]Data'!A1:A2),"No File"))
Note, you can add additional nested IFs if there are more files. Just start a new if where I wrote "No File".
I am creating an excel workbook file with one of the column containing a title of an image that is in another excel workbook file, that excel file contained huge database of images how to lookup images form that excel workbook file with their individual title
Note: these are two different Excel workbooks. And the condition is we can't merge file because imageDatabase file is so heavy up to 25MB for that reason excel is get not responding or force close.
file for example:
https://drive.google.com/a/flygoldfinch.com/file/d/0B9VV_J4sKTatdDBEZ01GNHg3Y0k/view?usp=docslist_api
Any reference to a cell in Excel can be performed on any other sheet, be it in the same file, or an outside file.
A reference to another sheet within the file looks like this:
='sheetname'!M20
The same thing works if that sheet is in a different file
='[file.xlsx]sheetname'!$H$726
Knowing that the reference will work that way, you can write any formula with it. This includes VLOOKUPs, or anything else you need to do.
A good shortcut to make this easier is to have both files open, click the cell you want to make the reference in, type =, then switch to the other file, click the cell you want, and hit return. Your reference is made.
I have a directory with many excel files with numeric data. In each file the data is arranged in the same manner (the same column names, etc...). I am interested to build an interactive
chart which will display the data according to the chosen file name.
For example, the file name will be chosen from validation list in a drop down menu fashion.
The question is how to specify the data range in the chart, such that it will change according to the name of the file that I choose.
I work with excel 2010 and don't have much experience with VBA programming :(
Thanks a lot,
Sasha
Well, a simple solution (there may be more elegant ways but that's a first hint):
Copy the data from your files in the Sheets of your workbook, you can create references (see here) or automate copies through macros (just STFW)
Create your validation list (for instance on Sheet1, cell A1). Let's assume this list contains: DataSource1, DataSource2, DataSource3.
Create Named Range for every other Sheet you have and use the same name as the one in your list (DataSource1, DataSource2, DataSource3)
In the chart source of values, use this formula: =INDIRECT(Sheet1!$A$1)
Hence, Excel will translate the source to the Named Range.
You could probably find solutions with vba too depending on your needs.
Regards,