Revision 326561343166 () - Diff

Link to this snippet: https://friendpaste.com/j4GDQaQsbkxeX8r2MoqWe
Embed:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Sub Main()
Dim x As Long
Dim y As Long
Dim l As String
Dim a As Variant
a = Selection.Value
If 1 < UBound(a, 1) Then
If 1 < UBound(a, 2) Then
LineFill a, UBound(a, 1), UBound(a, 2), 1, 1
End If
End If
For y = LBound(a, 1) To UBound(a, 1)
l = ""
For x = LBound(a, 2) To UBound(a, 2)
l = l & a(y, x)
Next
Debug.Print l
Next
End Sub

Sub LineFill(a As Variant, my As Long, mx As Long, y As Long, x As Long)
Dim i As Long
Dim ny As Long
Dim nx As Long
For i = y + 1 To my
If Not IsEmpty(a(i, x)) Then
Exit For
End If
Next
ny = i
nx = x + 1
For i = ny - 1 To y + 1 Step -1
If Not IsEmpty(a(i, x + 1)) Then
Exit For
End If
a(i, x) = " "
Next
a(i, x) = "└"
For i = i - 1 To y + 1 Step -1
If IsEmpty(a(i, x + 1)) Then
a(i, x) = "│"
Else
a(i, x) = "├"
End If
Next
If nx < mx Then
If y + 1 < ny - 1 Then
LineFill a, ny - 1, mx, y + 1, nx
End If
End If
If ny < my Then
LineFill a, my, mx, ny, x
End If
End Sub