|
Sub sx()
Dim arr, st$, n%, rg As Range, ar(1 To 5), rgg As Range, x%
st = [b2]
arr = Application.Transpose(Range("A4:A6"))
ReDim Preserve arr(1 To 5)
arr(4) = "学历"
arr(5) = "性别"
If Application.WorksheetFunction.Match(st, Range("K1:k" & Range("K" & Rows.Count).End(xlUp).Row), 0) > 0 Then
n = Application.WorksheetFunction.Match(st, Range("K1:k" & Range("K" & Rows.Count).End(xlUp).Row), 0)
Set rg = Range("K" & n & ":N" & Range("K" & n).End(xlDown).Row)
For x = 1 To 5
For Each rgg In rg
If arr(x) = rgg Then
ar(x) = Cells(rgg.Row, rgg.Column + 1)
Exit For
End If
Next rgg
Next x
End If
[b4] = ar(1)
[b5] = ar(2)
[b6] = ar(3)
[d4] = ar(4)
[d5] = ar(5)
End Sub
|
|