Hello,
My project involves using an Excel Macro to change data and Output the selected data. Currently, this is done using the execute macro feature, however I am struggling to find a way to save this output because it is created as a new Excel Document, rather than a new sheet. I have tried the save workbook feature, but it saves the old Excel Document, rather than the newly created one.
Here is the VBA code for the macro:
Sub Main()
Application.ScreenUpdating = True
Dim FileName As String
Dim SourceRange As Range
Sheets(“Input”).Select
Range(“A2”).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets(“Output”).Select
Range(“A2”).Select
ActiveSheet.Paste
Sheets(“Output”).Select
Range(“A2”).Select
Range(Selection, Selection.End(xlDown)).Select
Set SourceRange = Selection
For Each Row In SourceRange.Rows
Sheets(“Output”).Select
Row.Cells(1, 1).Select
ActiveCell.Formula2R1C1 = _
“=IFS(AND(Input!RC[10]=”“”“,Input!RC[8]=”“”“),Input!RC[9],Input!RC[10]=”“”“,Input!RC[8],Input!RC[10]<>”“”“,Input!RC[10])”
Next Row
For Each Row In SourceRange.Rows
Sheets(“Output”).Select
Row.Cells(1, 2).Select
ActiveCell = “A Careline engineer has been booked to attend your property.”
Next Row
Sheets("Output").Select
Application.CutCopyMode = False
Sheets("Output").Move
End Sub
and here is the Uipath studio workflow:
Any help, whether it is on uipath or changing the macro, will be helpful. Thank you!