Auto fill range variable

Hello,

Please, could you help me

I need to use auto fill range but the end of the line is always variable.
example I need to pull formulas from cells A2: up to H but I don’t know the line number.

Hi @LucasSilva!

What I usually do when I face this issue is first use a ReadRange activity to retrieve that data, thus allowing me to know how many rows there are.

Then in the auto fill range you would just do: "A2:H" + (dt.Rows.Count + 1).ToString where dt is the variable with the result of read range, and +1 is because your rows with data start from the second row of the Excel.

5 Likes

Hi @nerlichman,

The error below appears

image

Can you check the value of dt.Rows.Count and which is the last row in you example?

You need to show the details of the error, for better understand of the problem.

@bcorrea

RemoteException wrapping UiPath.Excel.ExcelException: O método AutoFill da classe Range falhou —> RemoteException wrapping System.Runtime.InteropServices.COMException: O método AutoFill da classe Range falhou
em System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32 aWrapperTypes, MessageData& msgData)
em Microsoft.Office.Interop.Excel.Range.AutoFill(Range Destination, XlAutoFillType Type)
em UiPath.Excel.WorkbookApplication.<>c__DisplayClass100_1.b__0()
em UiPath.Excel.ExcelContextHelper.Execute(Action action, ExcelContext context)
— End of inner exception stack trace —
em UiPath.Excel.Activities.ExcelInteropActivity`1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
em System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
em System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)


Teste.xaml (5.7 KB)

The destination must include the source range in the auto fill range… and it must go to one direction only, line or column…

2 Likes

It worked, I had forgotten that detail.
Thank you very much

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.