I wanted to run and invoke code that converts cells to numbers in excel but I got an error which is on the title above. Anyone has an idea ? thank you.
Code
Dim xlsApp As New Excel.Application
xlsApp.Visible = True
Dim xlsWorkbook As Excel.Workbook = xlsApp.Workbooks.Open(“\file.xlsx”)
Dim constant As Excel.XlCellType
constant = Excel.XlCellType.xlCellTypeConstants
With xlsWorkbook.Worksheets(1).Range(“E6:E22”).SpecialCells(constant, 2)
.NumberFormat = “General”
.Value = .Value
End With