Question QUESTION: How to change the name of the existing worksheet in excel
Eg: sheet1 to data1
how to insert a new row in the existing excel sheet.
and how to delete an empty row in the excel sheet
ANSWER: Sreedhar
How to change the name of the existing worksheet in excel:
Double click on sheet1 and press Del button and type what ever you want as sheet name
how to insert a new row in the existing excel sheet:
select the Row number where you want insert a new row and click right mouse button and select Insert Option.
and how to delete an empty row in the excel sheet:
Same as insert row, it means select that row which you want to be deleted and click right mouse button and select Delete option.
You can also do them using Macro code if you have a ton of them.
Subbu.
---------- FOLLOW-UP ----------
QUESTION: HI Subbu,
Thanks for spending time in replying me..
sorry for not asking the question in detailed..
Currently iam working with QTP so i have to do coding in VB Script.
Iam able to write the code as follows
set xlobj = createobject("excel.application")
set wrkbook = xlobj.workbooks.open("path of the xls sheet")
set wrksht = xlobj.worksheets("sheet name to interact with")
wrksht.rows(3).delete--> means we can delete the pirticular cell in excel sheet
*but i want to insert a new cell in the selected sheet
If possible please send me the answer.If not please let me know the right place to post the VB Script questions to get clarified..
Thanks in advance
sridhar
Answer I was thought the same that question is incorrect and you were trying to insert cells using VBA / qtp code. Here is your code:
wrkst.rows(3).delete means it delete entire 3rd row.
wrkst.rows(2).insert means it insert entire 2nd row.
Use .Cells(row,col) to insert or delete particular cell.
Example: wrksht.cells(3,1).insert 'It insert A3 cell in excel file.
wrksht.cells(2,2).delete 'It deletes B2 cell