Thursday 20 September 2012

1+(1+2)*2+(1+2+3)*3+(1+2+3+4)*4 if n=1 then o/p is 1 if n=2 then o/p is 1+(1+2)*2 if n=3 then o/p is 1+(1+2)*2+(1+2+3)*3

n=cint(inputbox("Enter the value"))

For i=1 to n
For j=1 to i

    c=c+j

    If j=i Then
        e=e+(c*j)
    End If

    Next
    c=empty
Next
print e

Sunday 8 July 2012

Export data to xlsx from Action1 datatable

  Set qSheet=DataTable.GetSheet("Action1")
fn=qSheet.getparametercount

Set ExcelApp=CreateObject("Excel.Application") 
ExcelApp.visible=true
     Set ExcelFile=ExcelApp.WorkBooks.Open ("E:\new.xls") 
     Set ExcelSheet = ExcelApp.WorkSheets("Sheet1") 
 
  rowcount= qSheet.getrowcount

For index1=1 to fn
fname=qSheet.getparameter(index1).name
ExcelSheet.cells(1,index1)=fname

next

For i=2 to  rowCount+1
For j=1 to fn
    fg=qSheet.getparameter(j).valuebyrow(i-1) 
ExcelSheet.cells(i,j)=fg
    next
Next

ExcelFile.save
ExcelFile.close
ExcelApp.quit


Saturday 19 May 2012

Get Data in odd Sheets From Excel

Set exc=createobject("excel.application")
Set bk=exc.workbooks.open("E:\new.xls")
Set sheets=bk.worksheets
d=sheets.count
For k=1 to d
If (k mod 2)<>0 Then
Set shts=bk.worksheets(k)

rc=shts.usedrange.rows.count
cc=shts.usedrange.columns.count
For i=1 to rc
    For j=1 to cc
rs=shts.usedrange.cells(i,j)
print rs

Next
next

End If
Next

bk.close
exc.quit

Thursday 12 April 2012

To Find Whether the Required Sheet is Present or Not in excel


Set exc=createobject("excel.application")
Set bk=exc.workbooks.open("E:\sac2.xls")
For each  m in bk.worksheets
If m.name="shtupdate" then
x=1
Exit for
end if
Next
If x=1 Then
msgbox"Sheet is present"
else
MsgBox"Sheet not found"
End If




Wednesday 11 April 2012

To Find Object BG Color


d=Browser("Google").Page("Google").Object.bgColor
print d

Compare Cells in single excelsheet


Set obj=createobject("excel.application")
obj.visible=true
Set obj1=obj.workbooks.open("E:\sac2.xls")
Set range1=obj1.worksheets(1).range("A1:B7")
Set range2=obj1.worksheets(1).range("C1:D7")

r1=range1.rows.count
c1=range1.columns.count
For i=1 to r1
For j=1 to c1
If range1.cells(i,j).value<>range2.cells(i,j).value Then
range1.cells(i,j).interior.colorindex=6
End If
Next

Next
obj1.save
obj1.close
obj.application.quit

OutPut :Here i compared cells between the range A1:B7 and C1:D7

Tuesday 10 April 2012

To find Armstrong Number


n=InputBox("enter the value")
For x=1 to n
For i=1 to len(x)
c=mid(x,i,1)
s=s+c^3
Next
If s=x Then
print "Armstrong Numbers are:  "&s
End If

s=empty
Next