Can UiPath make sub header?


I have activity to process an excel data into another excel data, but there’s sub header after the header. Take look at the picture below :


My current output right now is header1, header2, header3.

Is there any way for the robot to make the sub header after master Header? (Date today is dd MMM yyyy for example 1 Jul 2022)

Sure. It’s really just a case of writing your date to Row 1, then your Data to Row 2.

Merging the cells takes some more effort, but a little VBA could achieve it.



VBA Script
Save this in a text file, reference it as shown in screenshot above.

Function MergeCells(sheetName, startRow, startCol, endRow, endCol) As String
   On Error GoTo ErrorHandler
    With Sheets(sheetName).Range(Cells(startRow, startCol), Cells(endRow, endCol))
        .HorizontalAlignment = xlCenter
    End With
    MergeCells = "Success"
    Exit Function
    Debug.Print Err.Description
    MergeCells = "Error: " & Err.Description
End Function

You may also need to enable this the first time in Excel (if you’ve never done it before).

  1. Open Excel and go into File > Options
  2. Click the Trust Centre tab
  3. Click Trust Centre Settings…
  4. Click the Macro Settings tab
  5. Check the box for Trust access to the VBA project object model
  6. Click OK

instead of that you can try with pivot table activity

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