Hello,
I am trying to run a VBA in an excel using parameters because they change in each excel file. My macro is:
Sub Macro1(ParamArray arrColumns() As Variant)
Hello,
Thanks for your reply, I still have the problem I followed that explanation. The sheet name is stored in an input argument and the range is also in a variable. And my macro does not run. If I hardcode it in my file it runs but if I use arguments it does not work
Hi,
Generally speaking UiPath passes to VBA unnamed variables. As we see, you try to use named parameters in your VBA code. If you want your code to work you have two options:
Change Macro1 parameter array (ParamArray arrColumns() As Variant) to named parameters, e.g., mes As String, alcance As String. Then use Worksheets(mes).Range("A23:G" & alcance).Select
OR
Leave parameter as is, but use indexes in further code, e.g. Worksheets(arrColumns(0)).Range("A23:G" & arrColumns(1)).Select
Either way provide values in your activity (EntryMethodParameters input) , e.g., New String(){mes,alcance}. Order of parameters must be kept.