我正在尝试为要合并的快捷方式构建宏,然后如果快速连续再次触发键盘快捷键,则会合并整个选择。
我遇到的问题是,当它仍然在运行时,它似乎无法调用。有没有办法创建一个可以在它仍在运行时调用的函数/ sub,或者可能是另一种方式?
Sub MergeAcross()
Selection.Merge (Not MergeAll)
If MergeAll Then
MergeAll = False
Else
MergeAll = True
Dim NowTick As Long
Dim EndTick As Long
EndTick = GetTickCount + (2000)
Do
NowTick = GetTickCount
DoEvents
Loop Until NowTick >= EndTick
MergeAll = False
End If
End Sub
答案 0 :(得分:0)
Sub MergeAcross()
Static lastCallTime As Single
Selection.Merge (Timer - lastCallTime > 2)
lastCallTime = Timer
End Sub