¥»¤H¤@ª½¾Ç²ßVBA¤Îª¦¤å, µo²{³æ¤@VBA°ÝÃD¤£¤j, ¦ýnÓ¥\¯à´N¼Z¤J§x§½, ¤S¬O¦Ò¶Ôªí°ÝÃD, ´Á±æµ¹¤©¨ó§U:
¦Ò¶Ôªí 20150815.rar (109.15 KB)
±q¾Ç²ß®Ñ¤º§Û¦Ò¥Î¤F¬Û«H¬O·MÄøªº¤èªk, ¨D±Ð::Q
Sub match2()
'combine id card no and date for searching
Dim srcrange As Range, fndrange As Range
Dim fstaddress As String, i As Integer
Dim fc As Integer
Dim fr As Integer
Dim fr2 As Integer
Worksheets("attendance report").Activate
fc = 12
fr = 4
fr2 = 3
Set srcrange = Worksheets("data").Range("a4").CurrentRegion.Columns(9)
Set fndrange = srcrange.Find(what:=Range(fr, fc) & Range("v" & fr2).Value)
If Not fndrange Is Nothing Then
fstaddress = fndrange.Address
i = 5
Do
Cells(i, 22).Value = fndrange.Offset(, 0).Value
Cells(i + 1, 22).Value = fndrange.Offset(1, 0).Value
Cells(i + 8, 22).Value = fndrange.Offset(2, 0).Value
Cells(i + 9, 22).Value = fndrange.Offset(3, 0).Value
i = 1 + 1
Loop Until findrange.Address = fstaddress
Else
MsgBox "XX"
End If
End Sub |