Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Homework: 1 Magic square -s homewor Please read the following Macro and before y

ID: 3801421 • Letter: H

Question

Homework: 1 Magic square -s homewor Please read the following Macro and before you run it guess what the output ofthe program is Sub magicbox0 ROW 1 Range("B3"). Value Range( C3").Value Range ("D3"). Value Row2"Range(B4") Value Range("C4") Value Range("Da") Value ROW3 Range("B5%. Value Range("C5").Value t Range ("D5"). Value coll- Range("B3").Value Range B4").Value Range("B5"). Value col2-Range ("C3"). Value Range("C4").Value Range ("C5"). Value co13 Range ("D3"). Value t Range ("D4").Value Range("D5").Value dial Range ("B3") Value Range ("C4"). Value Range ("D5"). Value dia2-Range ("B3").Value Range("C4").Value Range("D5".Value Range("E3").Value- ROW1 Range ("E4") Value Row2. Range ("E5") value Row3 Range ("E6") Value-dial Range ("E2").Value dia2 Range("B6"). Value coll co12 Range("C6").Value Range ("D6"), Value col3. Range ("B3:D5"). Select With Selection Font size 16 Font Bold True Font Colorlndex. Automatic Font, Name "arial" Rows AutoFit Interior Colorlndex Int(Rnd 56) 1 Borders Weight-xlThick Borders.colorlndex Int(Rnd 56) 1 End With Range ("E2:E6") Select With Selection Font Size 16 Font Bold True Font Rows AutoFit End With Range ("B6:D6") Select With Selection Font Size Font Bold True Font Colorindex 5 Rows AutoFit End With End Sub

Explanation / Answer

The output of the above excel vba program will be:

8 1 6

3 5 7

4 9 2

it is called a magic square or magic box, you get 15 if you sum any of the row or column and its made of all the numbers from 1 to 9