Excel Borders using Vb.net Code in uipath

Hi @shashank_dullu

Try this code:

Sub HighlightFilledRows()
    Dim ws As Worksheet
    Dim lastRow As Long
    Dim rng As Range
    Dim cell As Range

    ' Specify the worksheet name
    Set ws = ThisWorkbook.Sheets("Sheet1") ' Change "Sheet1" to your sheet name

    ' Find the last row with data in column A
    lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row

    ' Loop through each row and check if it's filled
    For Each rng In ws.Range("A1:A" & lastRow)
        If WorksheetFunction.CountA(rng.EntireRow) > 0 Then
            ' Highlight the row if it's filled with a black border
            rng.EntireRow.Borders.LineStyle = xlContinuous
            rng.EntireRow.Borders.Color = RGB(0, 0, 0) ' Black color
        Else
            ' Remove borders if the row is not filled
            rng.EntireRow.Borders.LineStyle = xlNone
        End If
    Next rng
End Sub

Save this code in a text file and pass the text file path in Invoke VBA activity and Method name HighlightFilledRows.

Hope it helps!!