Question: Write a VBA code that calculates the total area of the rectangles that can be created with neighbour x ' s in a given 4

Write a VBA code that calculates the total area of the rectangles that can be
created with neighbour x's in a given 44 square matrix including x's and
O's.
4 x 4 square matrix will include only X's and O's in an Excel sheet starting
from A1.
Example:
When clicked on calculate button, message box should show 48.
Details of the solution is listed below:
The rectangles with a single square: A1, D1, B2, D2, A3, B3, C3, D3, B4, C4
Total area: 10
The rectangles with 2 squares: A3B3, B3C3, C3D3, B4C4, B2B3, B3B4,
C3C4, D1D2, D2D3
Total area: 18
The rectangles with 3 squares: A3B3C3, B3C3D3, B2B3B4, D1D2D3
Total area: 12
The rectangles with 4 squares: A3B3C3D3, B3C3B4C4
Total area: 8
Notes:
I will test your code with at least 10 different input sets.
A single square is also a rectangle.
Both width and length of the rectangle can be greater than 1 unit.
Please show your answer in a message box.
 Write a VBA code that calculates the total area of the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!