I have a excel in which the rows are not fixed I need to Highlight the borders to only the Rows which are filled for that instance . Either using Some activity or Vb.net Code .
Without borders-
With borders-
I have a excel in which the rows are not fixed I need to Highlight the borders to only the Rows which are filled for that instance . Either using Some activity or Vb.net Code .
Without borders-
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!!
You can use these Custom activities
UiPath Go ! BalaReva EasyExcel Activities - Help / Marketplace - UiPath Community Forum
Uipath set border in excel | change border color in excel (BalaReva) - YouTube
Hope This Help
You can try this
Sub TryBorder()
Dim dynamicRange As Range
Set dynamicRange = Range("A1").CurrentRegion
With dynamicRange.Borders
.LineStyle = xlContinuous
.Color = RGB(0, 0, 0)
.TintAndShade = 0
.Weight = xlThin
End With
End Sub
Cheers
Hi,
The following post may help you.
Regards,
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.