What is the way to apply all Borders to excel table?

We are facing selectors issue suggest a way how we can apply all borders to selected range in excel?kindly help

1 Like

Hi @Kancharla_Mahija

We can use the Invoke vba activity and write the vb code for this. So we can apply borders to the selected range in excel.

You can use the below code in Invoke vba activity,
Input.txt (729 Bytes)

Sub ApplyBorders(sheetName As String)
    Dim lastRow As Long
    Dim ws As Worksheet
    Dim rng As Range
    
    ' Set the worksheet based on the provided sheetName
    Set ws = Worksheets(sheetName)
    
    ' Find the last used row in column L
    lastRow = ws.Cells(ws.Rows.Count, "L").End(xlUp).Row
    
    ' Define the range from A21 to the last row in column L
    Set rng = ws.Range("A21:L" & lastRow)
    
    ' Apply borders to the defined range
    With rng.Borders
        .LineStyle = xlContinuous ' Change this to the desired line style
        .ColorIndex = xlAutomatic ' Change this to the desired color
        .Weight = xlThin ' Change this to the desired line weight
    End With
End Sub

Modify the range based on your excel range.

Hope it helps!!

Hi @Kancharla_Mahija

Please check this

Cheers!!

1 Like

@Kancharla_Mahija

check it

Hi @Kancharla_Mahija

Input:-
image

Output:-
image

Xaml File:-
BorderExcel.zip (10.7 KB)

If this works for you, Please mark it as a solution. So others can refer the same… :slight_smile:
Thanks

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