|
つづいて?
B列は
Cells(3, 2) = 80 / R2C3
Cells(4, 2) = 80 / R2C4
Cells(5, 2) = 80 / R2C5
Cells(6, 2) = 80 / R2C6
Cells(7, 2) = 80 / R2C7
まとめると
Sub Try3b()
[B3:B7].FormulaR1C1 = "=80/(indirect(""R2C""&ROW(),))"
End Sub
'C列は
' Cells(4, 3) = 80 / R3C4
' Cells(5, 3) = 80 / R3C5
' Cells(6, 3) = 80 / R3C6
' Cells(7, 3) = 80 / R3C7
'まとめると
Sub Try3c()
[C4:C7].FormulaR1C1 = "=80/(indirect(""R3C""&ROW(),))"
End Sub
'D列は
' Cells(5, 4) = 80 / R4C5
' Cells(6, 4) = 80 / R4C6
' Cells(7, 4) = 80 / R4C7
'まとめると
Sub Try3d()
[D5:C7].FormulaR1C1 = "=80/(indirect(""R""&COLUMN()&""C""&ROW(),))"
End Sub
'E列は
' Cells(6, 5) = 80 / R5C6
' Cells(7, 5) = 80 / R5C7
'まとめると
Sub Try3e()
[E6:E7].FormulaR1C1 = "=80/(indirect(""R""&COLUMN()&""C""&ROW(),))"
End Sub
'F列は
' Cells(7, 6) = 80 / R6C7
Sub Try3f()
[F7].FormulaR1C1 = "=80/(indirect(""R""&COLUMN()&""C""&ROW(),))"
End Sub
'以上Loopで表すと
Sub Try33()
Dim c&, r&
For c = 1 To 6
r = c + 1
Cells(r, c).Resize(7 - c).FormulaR1C1 = _
"=80/(indirect(""R""&COLUMN()&""C""&ROW(),))"
Next
End Sub
|
|