I want to filter column based on value and highlight the only cell from that column.
Eg if Column A has 5000 rows and suppose there is value “3” or “4” in particular cell so need to highlight only those cells from column A not whole row but only cell which contains “3” or “4” value.
Is there any vb code for filtering the columnn and at the same time highlighting the cell ?
From UiPath studio activity it will take large amount of time as my rows count in Excel will be around 80-90k…
Hi @OmkarKd
The following vb code might be help for you
Sub FilterAndHighlight()
Dim ws As Worksheet
Dim rng As Range
' Set the worksheet to work with
Set ws = ThisWorkbook.Sheets("Sheet1") ' Replace "Sheet1" with the actual sheet name
' Apply filter on column A to show only specific values
ws.Range("A1").AutoFilter Field:=1, Criteria1:="FilterValue" ' Replace "FilterValue" with the value you want to filter
' Get the range of filtered cells (excluding headers)
Set rng = ws.AutoFilter.Range.Offset(1).SpecialCells(xlCellTypeVisible)
' Highlight the filtered cells with a color
rng.Interior.Color = RGB(255, 0, 0) ' Replace RGB(255, 0, 0) with the desired highlight color
' Turn off the filter
ws.AutoFilterMode = False
End Sub
Regards,
Hi @lrtetala
Thanks for the code…I will try and let you know.
Just wanted to know I should write this code in invoke code of UiPath studio . Right ?
And if yes then what do I need to import in namespace ?
Hi @lrtetala
I tried with your code. But an error is coming.
Sharing you the screenshot of the same.
Let me know if something I am missing ?
Hi @lrtetala any reply on this ??
Can you help me with the same ?