I have the following formula:
=MID(CELL("filename"),FIND(".xls",CELL("filename"))-4;4)
It looks for the last 4 characters in the filename.
This works correctly, however when I open another workbook, or do a modification in a different workbook and return to this workbook it changed it's calculation result to the last 4 characters of the last used workbook, prior to activating this workbook.
Is there a way (avoiding vba and not messing with calculation to manual) to prevent this?
Related
I have a macro, and I am struggeling with saving. The macro:
opens second workbook from SharePoint
unprotects it
unprotects a sheet in the original workbook
copies line(s)
pastes those line(s) in the second workbook
protects the sheet in the second workbook
saves the second workbook
closes it
protects the sheet in original workbook
I have this macro in 4 files, always 1 original file - 1 second file. Two files are without any problems, but the other 2 files, I can't save the second file. It says that there is already a file with this name, and asks if I want to rewrite it.Why does it ask that, when I am using the function .Save?Or, if this cannot be managed, how do I write in the macro that it should choose - yes, rewrite?
Thank you.
I tried to use the combined function Close SaveChanges:=True, but it didnt help.
The question closest to mine did not return a satisfactory answer.
Inserted formula with cell reference does not recognize new input
In a particular macro-enabled workbook, macro-generated formulas do not change output values when data in referenced cells is changed. For instance, I can enter some numbers in referenced cells and the formula-containing cell will show the calculated number, but those numbers will not change when changing the data in the references. Manually typed formulas in the same workbook show the same behavior regardless of being in or outside range objects or in non-macro generated worksheets within this workbook. It doesn't seem to be specific to any particular formula.
I checked that the cells are formatted as numbers and that the formulas are valid. Formulas still appear in the cells after computing values.
Reloading the same workbook without macro-enabling shows the formulas working correctly.
In another macro-enabled workbook no problem is observed.
I checked property settings in the VBA editor and found no differences between them.
It seems like something is going on related to macro-enabling and not any particular code that is causing formulas to become unresponsive, but I am stumped as to what that could be.
Here is the formula in which I noticed the problem:
in "=d4:d21" the array formula "{=IF(ISNUMBER(C4:C21), C4:C21/C3, "0")}"
Even with a simple formula placed anywhere on the sheet like "=average(f4:f6)", this problem occurs.
I think creating the macro containing these lines of code is when the issue started, but they are not specific to it:
Sub CreateDataSheet()
Sheets.Add After:=ActiveSheet
Range("d4:d21").Select
Selection.FormulaArray = _
"=IF(ISNUMBER(RC[-1]:R[17]C[-1], RC[-1]:R[17]C[-1]/R[-1]C[-1], ""0"")"
End Sub
How can I get these formulas to work again?
The calculations in the workbook were set to 'manual' and I changed it to 'automatic'. The formulas work now.
I have a workbook which is used for processing data sets.
It's set up in such a way that it processes a bunch of data that I copy and paste into tables, and after it does all the calculations, it spits out an output sheet, as well as a bunch of charts relating to the output sheet.
I then use the Copy to another workbook option to capture the output.
My problem is this: I do this one set at a time for Mon through Fri. However, each time I update the original, the copied worksheets update to reflect the changes, meaning by the end, I have 5 days' of Friday's processed data.
Is there a way to stop this from happening?
I see that the copied/moved sheets still reference the original workbook by name...
Just tried this: Doesn't work:
XXXMaybe: moving the sheets to a new workbook instead of copying will help this, followed by closing the original processing workbook without saving, then reopening it in its blank state to process the next set of data.XXX
Thanks all.
edit: Excel 2010
edit 2: Moving then reopening doesn't help...
I have an Excel spreadsheet with multiple worksheets in it. I have found that if I save more than one worksheet as a PDF file the formula calculation option setting changes to Manual. If I save a single worksheet as a PDF it remains at Automatic. I need it to remain Automatic as sometimes the figures in the worksheet need to be amended and recalculated.
Any advice on how to get round this?
I have a workbook with two sheets. The first is full of data and calculations, the second is mostly cells with references to the first sheet. The second sheet also concatenates strings, and references to cells in the sheet, to form SQL commands used elsewhere.
There is also a second workbook (soon to be more). It has a sheet identical to the first sheet of the other workbook, except with different data. The problem I'm having is that the new workbook needs a sheet similar to the second of the original workbook (sorry if this is sounding confusing). I would like to simply duplicate the sheet and its formulas, which I tried using the 'move or copy...' option. Unfortunately, the formulas in the cells reference the first sheet from the old workbook, like this: =[foobar.xlsx]data!A1. Way too much data to remove them by hand. I can't just redo the formulas because I had to remove a lot of specific lines from the second sheet, so dragging the formula would not match up correctly. I'm currently trying to hack this together with REPLACE but if anyone can offer help it would be greatly appreciated.
CLARIFICATION:
When I copy the sheet, a formula will appear as =[foobar.xlsx]data!A1. I want it to just be data!A1.
Thanks :)
I hope this answers your problem, but I am a little unclear on your need!!!
Highlight all cells in the worksheet.
Perform a replace to replace = with say '=
This stops the formulas "being formulas"
Copy the sheet.
Perform another replace on the new sheet to replace '= with =
This converts back to formulas, referring to cells in your new workbook.