|
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim mxr1, mxr2 As Long
mxr2 = Sheets("sheet3").[a1048576].End(xlUp).Row
If mxr2 > 6 Then
Sheets("sheet3").Range("a7:g" & mxr2).ClearContents
End If
Dim arr1, arr2, arr3(1 To 10000, 1 To 7)
mxr1 = Sheets("2014").[a1048576].End(xlUp).Row
arr1 = Sheets("2014").Range("a1:h" & mxr1)
arr2 = Sheets("sheet3").Range("b1")
For i = 5 To mxr1
If arr1(i, 1) = arr2 Then
k = k + 1
For j = 2 To 8
arr3(k, j - 1) = arr1(i, j)
Next j
End If
Next i
Sheets("sheet3").[a7].Resize(k, 7) = arr3
End Sub
|
|