Posted: 13 Nov 2019 9:26 EST Last activity: 23 Dec 2019 8:53 EST
How do I run a formula in a Excel Workbook file? or can I assign a hotkey like Alt+D to use it?
I want to know if there's a way to run a formula on a simple worksheet of Excel in a determine cells space, like run the formula from cell H2 to T9. Also if I can execute a command on the sheet, e.g. Alt+D or Alt+Shift+I or something similar.
I attached a screenshot of the excel doc where I'd like to run the formula on
You can call the Calculate method on a Range. To do that is a little tricky. If your worksheet is the active one already, start at step 3 and supply the ExcelWorkbookActiveSheet property to the WorksheetGetRange method.
You'll need to get the ExcelWorkbook property of the MicrosoftExcel Connector. Drag this onto your automation surface.
There's a method called WorksheetGetByName that can return a Worksheet object by supplying the name of the worksheet you wish to operate on. Pass the result of this to the next step.
Pass in the worksheet from the prior step and then supply a starting and ending cell. If you are running on a single cell only, use it as both the start and end (A1-A1).
Extract a proxy from the "range" result.
On the range proxy, execute the "Calculate" method.