|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Option Explicit
Sub test()
Dim ar, i&, j&, k&, r&, c&, n&, x1#, y1#, x2#, y2#
Application.ScreenUpdating = False
ActiveSheet.Lines.Delete
r = Cells(Rows.Count, "H").End(xlUp).Row
With Range("H3:S" & r)
r = .Rows.Count: c = .Columns.Count
For i = 1 To r Step 16
With .Cells(i, 1).Resize(11, c)
Intersect(.Offset(), .Offset(1, 1)).Cells.Clear
ar = .Value
For k = 2 To UBound(ar)
n = 0
For j = 2 To UBound(ar, 2)
If ar(1, j) = ar(k, 1) Then
With .Cells(k, j)
.Value = ar(k, 1)
.Interior.Color = 15849925
n = 0
End With
Else
n = n + 1
.Cells(k, j).Value = n
End If
Next j
Next k
n = 0
For j = 2 To UBound(ar, 2)
For k = 2 To UBound(ar)
With .Cells(k, j)
If .Interior.Color = 15849925 Then
If n = 1 Then
x2 = .Left + .Width / 2
y2 = .Top + .Height / 2
ActiveSheet.Shapes.AddLine x1, y1, x2, y2
With ActiveSheet.Shapes.AddLine(x1, y1, x2, y2).Line
.DashStyle = msoLineSolid
.BeginArrowheadStyle = msoArrowheadOval
.EndArrowheadStyle = msoArrowheadOpen
.Weight = 1
.ForeColor.ObjectThemeColor = msoThemeColorAccent6
End With
x1 = x2: y1 = y2
Else
x1 = .Left + .Width / 2
y1 = .Top + .Height / 2
n = 1
End If
End If
End With
Next k
Next j
End With
Next i
End With
Application.ScreenUpdating = True
End Sub
|
评分
-
2
查看全部评分
-
|