montecarlo2012
Well-known Member
- Joined
- Jan 26, 2011
- Messages
- 986
- Office Version
- 2010
- Platform
- Windows
Hello everyone.
I have
so the results I expect are
and what I have been doing is
so from here I can see a variable 9 to 13 and another 2 to 6 for that then I did
but do not work
so: what I did wrong
thank you for reading this
I have
Book1 | |||||||
---|---|---|---|---|---|---|---|
B | C | D | E | F | |||
1 | |||||||
2 | 8 | 11 | 13 | 14 | 34 | ||
3 | 1 | 3 | 21 | 25 | 27 | ||
Sheet1 |
so the results I expect are
Book1 | |||||||
---|---|---|---|---|---|---|---|
I | J | K | L | M | |||
1 | |||||||
2 | 8 | 11 | 24 | 28 | 43 | ||
Sheet1 |
and what I have been doing is
VBA Code:
Sub Pytagoras_one()
Cells(2, 9).Formula = "=trunc(SQRT(" & Cells(2, 2).Address & "^2 + " & Cells(3, 2).Address & "^2))"
Cells(2, 10).Formula = "=trunc(SQRT(" & Cells(2, 3).Address & "^2 + " & Cells(3, 3).Address & "^2))"
Cells(2, 11).Formula = "=trunc(SQRT(" & Cells(2, 4).Address & "^2 + " & Cells(3, 4).Address & "^2))"
Cells(2, 12).Formula = "=trunc(SQRT(" & Cells(2, 5).Address & "^2 + " & Cells(3, 5).Address & "^2))"
Cells(2, 13).Formula = "=trunc(SQRT(" & Cells(2, 6).Address & "^2 + " & Cells(3, 6).Address & "^2))"
End Sub
VBA Code:
Sub Pytagoras_two()
For i = 9 To 13
For j = 2 To 6
Cells(2, i).Formula = "=trunc(SQRT(" & Cells(2, j).Address & "^2 + " & Cells(3, j).Address & "^2))"
Next
Next
End Sub
so: what I did wrong
thank you for reading this