Rupali Agarwal
New Member
Need C# code for Set Auto Filter
Please refer the video for setting filter in Excel using Blue prism:Need C# code for Set Auto Filter
Dim xl, wb, ws, r As Object
Try
xl = System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application")
wb = xl.activeworkbook
ws = wb.activesheet
r = ws.range(Ref)
r.autofilter(field:=Field, Criteria1:=Criteria, VisibleDropDown:=True)
Catch e As Exception
Throw e
Finally
xl = Nothing
wb = Nothing
ws = Nothing
r = Nothing
End Try
ThanksHello,
Code:Dim xl, wb, ws, r As Object Try xl = System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application") wb = xl.activeworkbook ws = wb.activesheet r = ws.range(Ref) r.autofilter(field:=Field, Criteria1:=Criteria, VisibleDropDown:=True) Catch e As Exception Throw e Finally xl = Nothing wb = Nothing ws = Nothing r = Nothing End Try
with the Inputs:
Ref - range in the format "A:A"
Field - number of the column to filter by, example: 5
Criteria - formula to filter, example: >50
Please refer the video for setting filter in Excel using Blue prism:
Hope it helps