你需要一个魔术。 ;)
对于承诺,首先在每个Entry
与头Entry
的重复下面的区域补。基本上,A1:A2
应该有Entry1
,A3:A4
应该有Entry2
和A5:A7
应该有Entry3
。
以下子程序可以完成上述操作。
Sub Pledge()
Dim LRow As Long: LRow = Range("B" & Rows.Count).End(xlUp).Row
Dim CurrentName As String
CurrentName = ""
For Iter = 1 To LRow
If Range("A" & Iter).Value <> "" Then
If Range("A" & Iter).Value <> CurrentName Then
CurrentName = Range("A" & Iter).Value
End If
Else
Range("A" & Iter).Value = CurrentName
End If
Next Iter
End Sub
截图:
对于转,我们只是范围根据列答:这是相当简单的排序。
Sub Turn()
Range("A:C").Sort Range("A1"), xlAscending
End Sub
截图:
但它从来没有过吧?你还没有拍手,直到它被带回来。这里是Prestige。
Sub Prestige()
Dim LRow As Long: LRow = Range("B" & Rows.Count).End(xlUp).Row
Dim CurrentName As String
CurrentName = ""
For Iter = 1 To LRow
If Range("A" & Iter).Value <> "" Then
If Range("A" & Iter).Value = CurrentName Then
Range("A" & Iter).Value = ""
Else
CurrentName = Range("A" & Iter).Value
End If
End If
Next Iter
End Sub
而且你去那里。将上述内容粘贴到一个模块中并逐个调用,或者在一个子例程中自行修改它们。这部分我留给你。 :)
Sub GrandIllusion()
Pledge
Turn
Prestige
End Sub
尝试记录一个宏,然后命令列C,然后B,然后A,然后看到VBA代码。 – Makah