Excel for Mac - Cells containing user-defined functions won't update - macos

I'm working on some VBA code that writes formulas containing user-defined functions (UDFs) into certain cells of my workbook, e.g.: H1004 = maxdd(H1:H1001).
When I run the code in Excel 2010 (for Windows) everything works as expected:
1) the formulas are written into the cells
2) each cell returns the correct result.
When I run the same code in Excel 2011 for Mac the formulas will also be written into the cells. However, the cells won't return any valid results - instead they display #value errors.
Note: I can't troubleshoot this issue because when I select one of these cells, put the cursor in the formula field, and press return (presumably forcing the cell to evaluate), the correct answer appears.
My question:
What needs to be done to keep Excel for Mac from returning #value errors instead of the plain results?

I finally figured out what caused this problem, although I have no idea why it caused the problem:
In order to make the vba code run faster, I had turned off automatic calculation at the beginning of the code and turned it back on at the end of the code, just like this -->
Application.Calculation = xlCalculationManual
'main part of vba code
Application.Calculation = xlCalculationAutomatic
For some reason, this kept the cells containing user-defined functions from being updated.
Without these two lines of code everything works fine now.

Related

Power Automate create folder from excel cell

I'm trying to create a folder as part of a flow, based upon an excel cell value.
The flow works if I use a cell value from the excel sheet that is a straight value such as "Folder 1", but just comes up blank when I use a cell that is a formula such as "=B2 & " RFE " & ROW(2:2)".
Is there a way to get past this? Am I right in thinking that it's not working because I'm referencing a formula and not a value?
I can't speak to your flow specifically and the issue you're seeing with the way you're retrieving that value (you haven't shown it) but another way to pull data from Excel and be a lot more specific about it is to use Office Scripts.
If you've never used them before, this can help you get started.
https://support.microsoft.com/en-us/office/introduction-to-office-scripts-in-excel-9fbe283d-adb8-4f13-a75b-a81c6baf163a#:~:text=Getting%20started,steps%20you%20want%20to%20automate.
In relation to a script that can help you, if you create a new script called Get Cell Value and paste this code in ...
function main(workbook: ExcelScript.Workbook, worksheetName: string, cellAddress: string)
{
return workbook.getWorksheet(worksheetName).getRange(cellAddress).getText();
}
... you can then call it from PowerAutomate and it will give you the right answer.
You can see in my example, the first cell is a formula. From PowerAutomate using the Run script action, it works as expected.
You can then use the resulting value to create your folder.

Google Sheets Script Performance With Slow Custom Function

Setup:
I have a Google sheet where I would like to run a custom function implemented using a script. This script is used to perform a relatively lengthy URL lookup and decode process (10 ms per call, dependent on bandwidth and ping). The custom function uses one column as input, and returns the result.
Problem:
When my Google sheet is opened, the column that uses this calculation is refreshed. This grinds the Google sheet to a halt for about 10 seconds, until each cell in the column is recalculated. This will only become worse as I add to my spreadsheet.
Question:
Can I change my function script, or change a setting in Google sheets so that the slow custom function is only calculated when the input cell is changed?
For anyone curious, here is a demo sheet with my problem
On my answer to In google sheets can I wrap a standard function in a custom function to control when it is run? I shared the idea of having a couple of buttons called "freeze" / "unfreeze" to control when the recalculation of "expensive formulas" is done.
On this case, you could "freeze" the range with your custom function before closing the spreadsheet so the next time that you open it will open faster, then when you need to update the frozen range you "unfreeze" it.
After posting the original version the OP asked for a simple version but as my original implementation was something quick and dirty with stuff in Spanish I shared there just the most important code lines. The core methods services are
A global variable to store the formula if it will always be the same
copyTo to overwrite the formula results range with the values a la copy-paste-values-only
clear to delete the formula results pasted previously
setFormula to add the formula back to the spreadsheet.
Then I realized that I could improved that published an unlisted Google Sheets add-on that use the PropertiesService to implement a "formula store" with functions to add/remove/list the formulas and a dynamic menu instead of buttons.
Something else to try is to use a time-driven trigger that runs, let say nightly just in case that you forgot to freeze the range for the custom function results.
Slightly better performance if there are less custom functions. You can rewrite your function to take in an array, so you'd only have one function instead of 100 running at once.
function mySlowFunction(x) {
//Utilities.sleep(x*100); //100 ms
if (x.map) {
return x.map(function(y) {return mySlowFunction(y) });
} else {
return x * 100;
}
}

Setting a cell in Numbers with AppleScript is broken

I have an AppleScript that's been working for several years that I use to populate a Numbers spreadsheet. It's suddenly stopped working and I can't figure out why. The line in question that fails is
set row newSalesRow's cell cellColumn's value to newValue
If I insert numbers for newSalesRow, cellColumn, and newValue it still crashes at that line. I tried
set cell cellColumn of row newSalesRow to newValue
but it also fails. The AppleScript error code is
"-1708: The script doesn’t understand the message. The event was not handled.".
After trying a number of different approaches and getting nowhere for several hours, I restarted Numbers. The problem disappeared. Very frustrating. Thanks for looking at the problem.

SSRS error on preview : "The size necessary to buffer the XML content exceeded the buffer quota" hides original error

I understand that there is definitely something wrong with my report (e.g. columns missmatcch) and I need to correct it but what I see is the WCF error message that hides actual problem and exactly this hiding irritates me much more than original problem: columns missmatch.
I guess we need to adjust the WCF 'buffer size' and we will get original problem message. But where is the config file?
Text search of "system.serviceModel" in the C:\Program Files (x86)\Microsoft Visual Studio 10.0 doesn't bring good idea...
P.S. Since this is just preview of report I do not think that it is SSRS configuration problem. Problem localised somewhere in DevStudio process or int the DevStudio's internal web server process ...
P.P.S Please help me too improve the question. I see that responders doesn't understand what kind of help I need.
I have encountered multiple "flavors" of this bug in SSRS Preview. It seems the renderer for Preview mode is quite fragile.
There is a simple way to solve this. Ignore the error and attempt to upload the RDL file to your reporting server. The uploader will happily tell you exactly what is wrong with your file - it will tell you exactly what field has a problem and what that problem is. If there are multiple errors, you will get told each and every field and the error associated with each one.
I can create this bogus XML buffer error with any of the following:
Add a new Tablix, start to connect it to a dataset, then cancel out.
Copy/paste some text into a textbox from a MS Word document where one or more lines have a negative right indent (right column end is outside page margin).
Connect a dataset with a varchar(8000) returned value.
Please Check if any of your report items are referencing fields that are not in existing dataset scope.
This indeed worked for me.
See Below link for more information:
http://connect.microsoft.com/SQLServer/feedback/details/742913/ssdt-reporting-services-designer-error
I have seen this error when adding a new field to an existing dataset by clicking "Refresh Fields".
The dataset source was a stored procedure. The result was only a few of original fields showed up in the dataset field list and not the new field. If I tried to preview the report I get XML buffer error.
Workaround was to not refresh fields but hit add new field and type the new field name into the dataset properties field last.
Worked fine after that.
I got this error again today.
I had created a table to hold data to replace two slow queries. I changed some names to clean up the process.
I think the error actually means that there are so many problems with my report that the buffer holding the various error messages isn't large enough which leads to the error message.
The size necessary to buffer the XML content exceeded the buffer quota
Of course this should be an easy fix but Microsoft has said that they will not fix it.
https://connect.microsoft.com/SQLServer/feedback/details/742913/ssdt-reporting-services-designer-error
EDIT: I've updated my answer based on having fixed the issue.
I'm currently experiencing this problem after having changed multiple stored procedures and updating the dataset names in the SSRS report.
And when I try to run the preview I get the exact same error.
As it turns out, after investigating the issue, the problem was that I had changed the name property of my datasets.
There several places in my report where formulas or expressions use the old name properties of the datasets I renamed. After reverting the dataset names back, I managed to get the real errors like missing fields etc. atcual errors came back after I set my dataset name properties back to what they were.
I only changed the name property back to what it was, the stored procedure names were correctly referring to my renamed stored procedures.
I had this problem when after copying and pasting a tablix, it changed CDbl in a formula to Microsoft.ReportingServices.RdlObjectModel.ExpressionParser.VBFunctions.CDbl. I opened up the XML and removed all instances of "Microsoft.ReportingServices.RdlObjectModel.ExpressionParser.VBFunctions." and the report then worked.
For a working report, when I tried to add a column it gave me this error. I edited the .rdl file using notepad++. After SSRS prompt to reload the change from disk, it worked without issues.
I got this error after copying my Custom Code to Visual Studio for hightlighting the code for better readability. Well, Visual Studio added class definitions to the beginning and end of the file. After editing code, I pasted it back to report Custom Code, then got this error. Fix was just to remove class definitions (Public Class Class1 and End Class) from Custom Code. So, check your Custom Code also (if any).
I got this error after adding some new parameters to an existing report.
For some reason when I created the parameters first then modified the Dataset to use the new parameters I got the error, but when I modified the Dataset first then added the parameters second and I did not get the error.
This seemed like very strange behavior to me so I tested it by restoring the report from repository and repeating the process three times with each method, and had identical behavior every time.
I am also facing this problem. I solve this Find and replace
Microsoft.VisualBasic.Interaction.iif ==> iif
Microsoft.ReportingServices.RdlObjectModel.ExpressionParser.VBFunctions.cdbl
==> cdbl
I hope this may helps someone. Thanks
Possible root causes
Parameter name is incorrect(case/order)
Accessing non-existing property.
and many more...
Solution: To get the exact error message are
Deploy SSRS report and find the error : Suggested by "Kim Crosser" already
Remove the section(SSRS/Report content) temporarily you feel is error free to free space in buffer so that you can get actual error message. Later add sections back to the page(removed earlier).
I had the same error message and it was totally caused by my doing. It's a bit embarrassing, but if it helps someone out then great! I had accidentally copied my dataset query that included a small sub select statement within it, which I was using to check parameter/variable values.
Another solution is to open the .rdl file in Report Builder 3.0 (as opposed to Visual Studio) and try to preview it. I found this gave me the details of the error, although if more than one error is present it only shows the first.
I previously binded a TextBox to
Fields!FieldName
and fixed it with
Fields!FieldName.Value
With that said, and with the other answers posted as well, this error happens in different flavors. My issue was fixed after I had the field property "Value" included.

RDLC Report With Empty DataSet

I'm currently trying to get an rdlc report to work, and it works fine except when I pass an empty dataset to it (the dataset is determined dynamically at runtime -- ugly, but this is the code I was passed and I'm not quite experienced enough to really feel confident about wiping it and rewriting it). When I pass it an empty DataSet, it fails with an "Object reference not set to an instance of an object." The strange thing is, I have another report that gets passed a similar DataSet, but it doesn't fail. I'm not quite sure why one report with an empty DataSet is failing, but the other is not.
Any help is much appreciated!
Figured it out. As it turns out there was a stray parameter that wasn't getting set... rebuilding the report from the ground up did the trick.

Resources