Convert formulas into values
Converts all formulas in the active worksheet into values.
This macro was converted from VBA code using the AI plugin.
(function(){
// Get the active sheet
var oWorksheet = Api.GetActiveSheet();
// Get the used range of the active sheet
var oUsedRange = oWorksheet.GetUsedRange();
// Check if there is a used range
if (oUsedRange) {
// Get the current values from the range (this will evaluate formulas)
var aValues = oUsedRange.GetValue();
// Set the values back to the range (this replaces formulas with their calculated values)
oUsedRange.SetValue(aValues);
}
})();
Methods used: GetActiveSheet, GetUsedRange, GetValue, SetValue
Reference Microsoft VBA macro code
Sub ConvertToValues()
With ActiveSheet.UsedRange
.Value = .Value
End With
End Sub