Excel macros

Hi Team, I have some excel files, in which I have to copy the data from fixed cells and have to paste in other excel. Can I use macros for that, if yes can you please guide me how to do with macros.

Hi @nagini.pragna

Yes we can use macros for this type of process,

Refer this site for how to create a macro and run through UiPath,

Here is the reference for how to copy data from one workbook to other using VBA


If copy and paste is the only operation we can do that in UiPath itself using read range and write range activities.


1 Like

Hi @nagini.pragna

Is the issue resolved?


Hi, Thanks for the reply. Can I use macros without using the excel application scope activity, can you help me with that reference link??

Hello @nagini.pragna ,

May I ask you why you don’t want to use Excel Application Scope?

Hi, Thanks for the reply, I am using ‘run’ to open the excel file and the file should be open during my process. So any way is there where can I use macros without excel application scope.

Okay, an alternative could be:

  1. Create a Macro button inside the excel sheet. (When you click this macro button, the macro will run)

  2. You can use a normal click activity on the button.


1 Like

Hi @nagini.pragna

You can close the excel file and start triggering the macro, or sky you want to open the excel until the process completed?

And also , the macro file is not opened right,it is some other files,so it won’t have an impact in triggering the macro.


1 Like

Hi, Thanks for the reply. I want to locate a cell which is having the last date of previous month in a .xls file (the date will be always in A column) and I have to copy that row and paste in another .xls file. Can you give me any reference for this macro??

Hi @nagini.pragna

Please try this,

Sub GetRowNum()

Dim lRow As Long
 On Error Resume Next
 lRow = Application.WorksheetFunction.Match(Format(DateAdd("m", -1, now), "dd mmmm yyyy"), Range("A:A"), 0)
 On Error GoTo 0

Range(lRow & ":" & lRow).copy

 '''paste this in other .xls file

End Sub

For reference



1 Like

we would recommend that at first the requirements / what is to do will be specified. Then the appropriate solution approach strategy will be checked. This allows ua to avoid XY Problems.

As the copy of data changed now to a last date check we do see changed scenario. Maybe you can alos share some sample data along with your finalized case description. Thanks

Hi, thanks For the reply. I am having 6 excel files in which i have to perform different sort of manipulations, In one I have to copy and paste the entire sheet and in another the requirement is which I posted lately. I will take of that in future.

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