Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want to store result in exce sheet
#4
Solved: 11 Years, 4 Months ago
Hi,

You can use the following code to store the data in excel:

Code:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.DisplayAlerts = False
Set objWorkbook = objExcel.WorkBooks.Open("path of the file.xls")  'this is the name of the excel file
Set objDriverSheet = objWorkbook.Worksheets("Sheet1")  'this is the sheet name in the excel file

columncount = objDriverSheet.usedrange.columns.count
rowcount = objDriverSheet.usedrange.rows.count
i = rowcount

If rowcount = 1 Then
   objWorkbook.Sheets("Sheet1").Cells(i,1).Value = a
   objWorkbook.Sheets("Sheet1").Cells(i,2).Value = b
Else
   i = i+1
   objWorkbook.Sheets("Sheet1").Cells(i,1).Value = a
   objWorkbook.Sheets("Sheet1").Cells(i,2).Value = b
End If

objWorkbook.Save
objWorkbook.Close
objExcel.Quit
Reply


Messages In This Thread
I want to store result in exce sheet - by Ragini - 12-28-2010, 08:48 PM
RE: I want to store result in exce sheet - by joe.venom13 - 12-29-2010, 05:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  VB Script to separate upper & small Letters from a string and store in excel pradeep537 1 2,214 08-05-2016, 12:26 AM
Last Post: Ankur
  export data from one sheet to another sheet in data table raaj123 1 2,353 05-21-2013, 02:21 PM
Last Post: Shahzaad
Question Doesn't store value into database using Innertext Langxii 1 2,896 07-05-2011, 07:48 PM
Last Post: rajpes
  using queries in functions (Store Procedures) samson 1 2,139 03-12-2010, 01:20 PM
Last Post: Saket
  Checkpoint result affecting the script result sheetal 1 2,182 11-17-2009, 10:55 AM
Last Post: v_selvam

Forum Jump:


Users browsing this thread: 1 Guest(s)