Dear all,
'sheet2 have intnumbers span 1~45
With Sheet2
Sheet3.Range("b2:at46"). _
ClearContents
For h = 2 To 258
For i = 9 To 14
For j = i + 1 To 15
Sheet3.Cells(.Cells(h, i) + 1, .Cells(h, j) + 1) = Sheet3.Cells(.Cells(h, i) + 1, .Cells(h, j) + 1) + 1
Sheet3.Cells(.Cells(h, j) + 1, .Cells(h, i) + 1) = Sheet3.Cells(.Cells(h, j) + 1, .Cells(h, i) + 1) + 1
Next
Next
Next
End With
Regards,
2007-11-10
19:35:31
·
2 answers
·
asked by
mrlee
3
in
Computers & Internet
➔ Programming & Design
maybe find from book "excel power programming with vba"(jhon walkenbach)
Dim temparray(1 To 45, 1 To 45) As Integer
Application.ScreenUpdating = False
With Sheet2
Sheet3.Range("b2:at46").ClearContents
For h = 2 To 258
For i = 9 To 14
For j = i + 1 To 15
temparray(.Cells(h, i), .Cells(h, j)) = temparray(.Cells(h, i), .Cells(h, j)) + 1
Debug.Print temparray(.Cells(h, i), .Cells(h, j))
temparray(.Cells(h, j), .Cells(h, i)) = temparray(.Cells(h, j), .Cells(h, i)) + 1
Debug.Print temparray(.Cells(h, j), .Cells(h, i))
Next
Next
Next
End With
With Sheet4
.Range("b2:at46") = temparray
End With
Application.ScreenUpdating = True
2007-11-10
20:48:24 ·
update #1
hi,devilishblueyes
thanks for replying.
say more detail,sheet2 have 258 rows. Each row have 7 numbers span 1~45. sheet3 has 45X45 TABLE.
In sheet2, combination of 7 numbers for each row like x-y values and count x_y pairs to sheet3.
Sorry for not making problem in detail
2007-11-12
03:52:36 ·
update #2