I am running an Excel Macro from vb.net for sorting range of data and I receive this error as in the attached image
My Code is
Dim ws As Worksheet
Dim lastRow As Long
Set ws = Worksheets("Result_T10")
lastRow = Worksheets("Result_T10").Range("C2" & Cells(Rows.count, "C").End(xlUp).Row)
with ws
ws.Range("C2" & lastRow).Sort Key1:=Range("C2" & lastRow), Order1:=xlAscending, Header:=xlYes
End With
So What is wrong in the code?
Thanks, Regards
Moheb Labib