我有一个秒表,可以通过按下空格来控制,就像这样:
Vlookup
Sub MoveData()
'
' MoveData Macro
' moves data from DCC Status Report to Overdue Biennials Sheet
'
Windows("Overdue Biennials 12.18.xlsm").Activate
Dim lastB As Long
lastB = Range("B" & Rows.Count).End(xlUp).Row
Dim i As Long
i = (lastB + 1)
Dim r1 As Range
Set r1 = Range("B" & i)
Windows("Camden DCC Status.xlsx").Activate
Range("A2:E2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy Destination:=r1
Workbooks("Camden DCC Status.xlsx").Close savechanges:=False
End Sub
Sub UpdateData()
'
'finds duplicate value in column C and pastes the data in columns D-F into the 'first instance of the value in column C
'
Dim lastA As Long
lastA = Range("C" & Rows.Count).End(xlUp).Row
Dim lastB As Long
lastB = Range("C" & Rows.Count).End(xlUp).Row
Dim i As Long, j As Long
Dim r1 As Range, r2 As Range, r3 As Range, r4 As Range
For i = 2 To lastA
Set r1 = Range("C" & i)
For j = 2 To lastB
Set r2 = Range("C" & j)
If r1.Value = r2.Value Then
Set r3 = Range("D" & j, "F" & j)
Set r4 = Range("D" & i)
r3.Copy Destination:=r4
End If
Next j
Next i
End Sub
这很好用,除了有时按空格停止秒表时,它会停下来然后立即再次启动秒表。通常,这种情况一旦发生一次,便无法停止秒表,直到重新加载页面为止。
任何帮助将不胜感激。 谢谢。