How to delete rows range from the excel sheet
How to delete rows range from the excel sheet
''Call the below function where were required, passing the parameter values:
Function ExcelDeleteRowsRange (sXlPath, sDestPath, sStartRow, sEndRow)
‘Create Excel object
Set oExcel = CreateObject(“Excel.Application”)
‘Sets the application to raise no xl alerts
‘This case will allow a file overwrite w/o raising a ‘yes/no’ dialog
oExcel.DisplayAlerts = False
‘Open Book in Excel
Set oBook = oExcel.Workbooks.Open(sXlPath)
‘Set Activesheet
Set oSheet = oExcel.Activesheet
‘Delete row range
oSheet.Rows(sStartRow +”:”+ sEndRow).Delete
‘Save new book to Excel file
oBook.SaveAs (sDestPath)
‘Close the xls file
oExcel.Workbooks.Close()
End Function
Function ExcelDeleteRowsRange (sXlPath, sDestPath, sStartRow, sEndRow)
‘Create Excel object
Set oExcel = CreateObject(“Excel.Application”)
‘Sets the application to raise no xl alerts
‘This case will allow a file overwrite w/o raising a ‘yes/no’ dialog
oExcel.DisplayAlerts = False
‘Open Book in Excel
Set oBook = oExcel.Workbooks.Open(sXlPath)
‘Set Activesheet
Set oSheet = oExcel.Activesheet
‘Delete row range
oSheet.Rows(sStartRow +”:”+ sEndRow).Delete
‘Save new book to Excel file
oBook.SaveAs (sDestPath)
‘Close the xls file
oExcel.Workbooks.Close()
End Function
Similar topics
» How to delete columns range from the excel sheet
» Excel Sorting by Rows or/and Columns (Ascending or Descending)
» How to delete cookies using QTP?
» Excel Sorting by Rows or/and Columns (Ascending or Descending)
» How to delete cookies using QTP?
Permissions in this forum:
You cannot reply to topics in this forum
Thu Jun 19, 2014 11:31 am by thomasdfg
» How to identify the object when it is dynamically changing behavior
Wed Jun 18, 2014 6:37 pm by thomasdfg
» Patches for QTP 10, 11, 11.5
Wed Jun 18, 2014 6:04 pm by thomasdfg
» Retrieving data from Txt file into datatable
Wed Jun 18, 2014 5:32 pm by thomasdfg
» VB Script to count number of links in a web page.
Wed Jun 18, 2014 4:51 pm by thomasdfg
» Customized HTML reports in QTP
Wed Jun 18, 2014 4:42 pm by thomasdfg
» how to print values into a field of a web page, from a data table in qtp?
Wed Jun 18, 2014 4:37 pm by thomasdfg
» How to delete cookies using QTP?
Wed Jun 18, 2014 4:30 pm by thomasdfg
» When UFT Does Not Identify an Object
Wed Jun 18, 2014 4:23 pm by thomasdfg