| a | b | |
|---|
| 0 | + | Sub Main() |
|---|
| 0 | + | Dim x As Long |
|---|
| 0 | + | Dim y As Long |
|---|
| 0 | + | Dim l As String |
|---|
| 0 | + | Dim a As Variant |
|---|
| 0 | + | |
|---|
| 0 | + | a = Selection.Value |
|---|
| 0 | + | If 1 < UBound(a, 1) Then |
|---|
| 0 | + | If 1 < UBound(a, 2) Then |
|---|
| 0 | + | LineFill a, UBound(a, 1), UBound(a, 2), 1, 1 |
|---|
| 0 | + | End If |
|---|
| 0 | + | End If |
|---|
| 0 | + | |
|---|
| 0 | + | For y = LBound(a, 1) To UBound(a, 1) |
|---|
| 0 | + | l = "" |
|---|
| 0 | + | For x = LBound(a, 2) To UBound(a, 2) |
|---|
| 0 | + | l = l & a(y, x) |
|---|
| 0 | + | Next |
|---|
| 0 | + | Debug.Print l |
|---|
| 0 | + | Next |
|---|
| 0 | + | End Sub |
|---|
| 0 | + | |
|---|
| 0 | + | Sub LineFill(a As Variant, my As Long, mx As Long, y As Long, x As Long) |
|---|
| 0 | + | Dim i As Long |
|---|
| 0 | + | Dim ny As Long |
|---|
| 0 | + | Dim nx As Long |
|---|
| 0 | + | |
|---|
| 0 | + | For i = y + 1 To my |
|---|
| 0 | + | If Not IsEmpty(a(i, x)) Then |
|---|
| 0 | + | Exit For |
|---|
| 0 | + | End If |
|---|
| 0 | + | Next |
|---|
| 0 | + | ny = i |
|---|
| 0 | + | nx = x + 1 |
|---|
| 0 | + | |
|---|
| 0 | + | For i = ny - 1 To y + 1 Step -1 |
|---|
| 0 | + | If Not IsEmpty(a(i, x + 1)) Then |
|---|
| 0 | + | Exit For |
|---|
| 0 | + | End If |
|---|
| 0 | + | a(i, x) = " " |
|---|
| 0 | + | Next |
|---|
| 0 | + | a(i, x) = "└" |
|---|
| 0 | + | For i = i - 1 To y + 1 Step -1 |
|---|
| 0 | + | If IsEmpty(a(i, x + 1)) Then |
|---|
| 0 | + | a(i, x) = "│" |
|---|
| 0 | + | Else |
|---|
| 0 | + | a(i, x) = "├" |
|---|
| 0 | + | End If |
|---|
| 0 | + | Next |
|---|
| 0 | + | |
|---|
| 0 | + | If nx < mx Then |
|---|
| 0 | + | If y + 1 < ny - 1 Then |
|---|
| 0 | + | LineFill a, ny - 1, mx, y + 1, nx |
|---|
| 0 | + | End If |
|---|
| 0 | + | End If |
|---|
| 0 | + | If ny < my Then |
|---|
| 0 | + | LineFill a, my, mx, ny, x |
|---|
| 0 | + | End If |
|---|
| 0 | + | End Sub |
|---|
| ... | |
|---|