excelでの汎用的な利用に関して(計算式コピー):On general use in excel (formula copy)




invoke codeを利用してこのような処理を汎用的に利用と考えています。


Paste the data on excel to the next line after the last line.
Range of blue cells
After that, I would like to copy and paste using the last row of cells before pasting the calculation formula.
Pasting source: D3: E4
Pasting destination: D4: E6
Range of green cells

We use invoke code to consider such processing as general purpose.
I am abandoned without knowledge of vb.net.
A to C: Data area
D to E: calculation formula area

I think that you can teach how to realize with uipath.excel

Unable to Access Range of data in Excel using coding

sample.xaml (7.5 KB)

The syntax error no longer exists, but a runtime error occurs.
error contents
sample has thrown an exception
Source: Invoke code
Message: Exception has been thrown by the target of an invocation.
Exception Type: TargetInvocationException

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.NullReferenceException: Object reference not set to an instance of an object.
at UiPathCodeRunner_39d7c5a185dd47b58a091ed1617a27ad.Run(Application app, Workbook workbook, Worksheet xlsheet, Range xlrange, GC gc, Range xlPasteRange)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at UiPath.Core.Activities.Workflow.CompilerRunner.Run(Object[] args)
at UiPath.Core.Activities.InvokeCode.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)