Sub ImportXMLtoList()
Dim strTargetFile As String
Dim wb As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
strTargetFile = "C:\DELL\1c\CriticalTestCases_UB_S02028A_MB500_50_50.xml"
Set wb = Workbooks.OpenXML(Filename:=strTargetFile, LoadOption:=xlXmlLoadImportToList)
Application.DisplayAlerts = True
wb.Sheets(1).UsedRange.Copy ThisWorkbook.Sheets("Sheet1").Range("A10")
wb.Close False
Application.ScreenUpdating = True
Range("F11:F" & lastRow).Formula = "=(MID(C2,SEARCH('(',C2)+1,SEARCH(')',C2)-SEARCH('(',C2)-1)"
End Sub
On running this, Run time error 1004
Method 'Range' of '_Object' failed. error is shown