Logo 
Search:

GuestBook of Mystic Boy

 
Enter your message (HTML allowed after you earn 150 points)
Priya Mohana
  Priya Mohana from India      Jan 06
This is the code i have tried............

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MsgBox("Creating Proximity Matrix....")
Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim x2WorkSheet As Excel.Worksheet
Dim x3WorkSheet As Excel.Worksheet
Try
xlApp = New Excel.ApplicationClass
xlWorkBook = xlApp.Workbooks.Open("C:\Users\priya\Desktop\Project\Book1.xlsx")
x2WorkSheet = xlWorkBook.Worksheets("Sheet2")
x3WorkSheet = xlWorkBook.Worksheets("Sheet3")
Dim i, j, rCnt, cCnt, temp, rows, cols, dataCnt As Integer
rows = 5
cols = 5
For rCnt = 1 To rows
dataCnt = 1
For cCnt = 1 To cols
'MsgBox(x2WorkSheet.Cells(rCnt, cCnt).Value.ToString)
data(dataCnt) = x2WorkSheet.Cells(rCnt, cCnt).Value
tmpdata(dataCnt) = x2WorkSheet.Cells(rCnt, cCnt).Value
backup(rCnt, cCnt) = data(dataCnt)
dataCnt = dataCnt + 1
Next cCnt
dataCnt = dataCnt - 1
For i = 1 To dataCnt - 1
For j = i + 1 To dataCnt
If data(i) < data(j) Then
temp = data(i)
data(i) = data(j)
data(j) = temp
End If
Next
Next
rescnt = 1
For i = 1 To dataCnt - 1
For j = 1 To dataCnt
If ((data(i) = tmpdata(j)) And (data(i) <> 0) And (tmpdata(j) <> 0)) Then
res(rescnt) = j
End If
rescnt = rescnt + 1
Next
MsgBox(res(1))
MsgBox(res(2))
Next
Next rCnt

xlWorkBook.Close()
Finally
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp)
End Try
MsgBox("Proximity Matrix Created...")

End
End Sub


End Class
Priya Mohana
  Priya Mohana from India      Jan 06
HI..
Sorry....I have tried that code but it would have some problem..
That's why i asked a code by giving a concept..Since I am a new user to these forums and all..I don't know whether we can ask like this or not..Very sorry for asking like that...No problem I'll try it by my own...
Thank You for giving your concern ................