|
Option Explicit
Sub test()
Dim ar, i&, j&, k&, n&, x1#, y1#, x2#, y2#
Application.ScreenUpdating = False
ActiveSheet.Lines.Delete
With [H2:AM101]
For k = 1 To .Columns.Count Step 11
With .Cells(1, k).Resize(.Rows.Count, 10)
ar = .Value
n = 0
For i = 2 To UBound(ar)
For j = 1 To UBound(ar, 2)
If .Cells(i, j).DisplayFormat.Interior.ColorIndex = -4105 Then
If n = 1 Then
x2 = .Cells(i, j).Left + .Cells(i, j).Width / 2
y2 = .Cells(i, j).Top + .Cells(i, j).Height / 2
With ActiveSheet.Shapes.AddLine(x1, y1, x2, y2).Line
.BeginArrowheadStyle = msoArrowheadOval
.Weight = 1.14
.ForeColor.RGB = RGB(216, 31, 42)
End With
x1 = x2: y1 = y2
Else
x1 = .Cells(i, j).Left + .Cells(i, j).Width / 2
y1 = .Cells(i, j).Top + .Cells(i, j).Height / 2
n = 1
End If
End If
Next j
Next i
End With
Next k
End With
Application.ScreenUpdating = True
Beep
End Sub
|
|