Savelyev_Vyacheslav

VBA exel function - eval()

Apr 22nd, 2022 (edited)
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ### Макрос для excel добавляет ф-ю eval() что позволяет текс выполнить как исполняемый код
  2. Function Evaluate_Formula(formula_text As String) As Variant
  3.      Application.Volatile
  4.     Evaluate_Formula = Application.Evaluate(VBA.Trim(formula_text))
  5. End Function
  6.  
  7.  
  8. Function Text_Of_Formula(rng As Range) As String
  9.       Application.Volatile
  10.       Text_Of_Formula = rng.Formula
  11.  
  12.  
  13. End Function
  14. Function Eval(formula_text As String)
  15. formula_text = Replace(formula_text, ",", ".", 1)
  16.     Application.Volatile
  17.     Eval = Application.Evaluate(formula_text)
  18. End Function
Add Comment
Please, Sign In to add comment