Magic Squares
Private Sub AssignValueCell()
Dim row1 As Integer
Dim row2 As Integer
Dim row3 As Integer
Dim col1 As Integer
Dim col2 As Integer
Dim col3 As Integer
Dim diagonal1 As Integer
Dim diagonal2 As Integer
row1 = Cells(3, "B").Value + Cells(3, "C").Value + Cells(3, "D").Value
col1 = Cells(3, "B").Value + Cells(4, "B").Value + Cells(5, "B").Value
diagonal1 = Cells(3, "B").Value + Cells(4, "C").Value + Cells(5, "D").Value
Cells(6, "B").Value = col1
Cells(3, "E").Value = row1
Cells(6, "E").Value = diagonal1
End Sub
Related examples in the same category