Sunday, 14 June 2015

Copy and Paste a range of cell in Excel using VBScript

Using Below code you can copy and paste the range of cell from one place to another

Code:

Set ObjExcel= createobject("Excel.Application")
Set ObjWorkBk=ObjExcel.Workbooks.Open("D:\Pulkit.xls")
ObjExcel.Visible = True
ObjExcel.DisplayAlerts = False
Set ObjWorkSht=ObjWorkBk.worksheets("Sheet1")
ObjWorkSht.range("A1:B6").Copy
ObjWorkSht.Range("C1:D6").PasteSpecial
ObjWorkBk.Save
 ObjExcel.Quit

Please share your feedback on this :)

No comments:

Post a Comment