VBA to generate and draw vertical and horizontal lines following some rules

  • I have ground & ceiling data given in X, Y coordinates, which I plotted
    I want to split the area in between vertical and horizontal lines (constituting building blocks) and plot all; following some rules:


    # Vertical Lines
    Shall be every 4 feet apart. The line length is an even number with 2 feet increment (i.e. 2,4,6, etc).
    The vertical lines should NOT intersect with the ceiling. At least 2 feet needs to be left before it hits the ceiling.



    # Horizontal lines
    shall be every 4 feet up. The lines are an even number with 4 feet increment (i.e. 4, 8,12, …to whatever it takes)
    The lines should not intersect with the ceiling side slopes, at least 5 feet needs to be left sideways


    The lines should end up creating blocks (rectangles) in an organized format.

    I manually crated some lines (with formulas) for illustration purpose (attached) but I appreciate if I can accomplish this in VBA.

    It would be fantastic (but optional) to provide the number of blocks and the surface area to be covered, but again this is optional!

    Thanks for your help!


    04092021.xlsx