返回列表 上一主題 發帖

[發問] 比對不合格人員工號

回復 1# kasa
  1. Sub FindIDByStrComp()
  2.   Dim lngRow    As Long
  3.   Dim strFind   As String
  4.   Dim strValue  As String
  5.   Dim Range1    As Range
  6.   
  7.   With ActiveSheet
  8.     lngRow = .Range("C" & .Rows.Count).End(xlUp).Row
  9.     strFind = vbNullChar & Join(Application.WorksheetFunction.Transpose(.Range("C1:C" & lngRow).Value), vbNullChar) & vbNullChar
  10.     lngRow = .Range("B" & .Rows.Count).End(xlUp).Row
  11.     For Each Range1 In .Range("B1:B" & lngRow)
  12.       With Range1
  13.         .Interior.Pattern = xlNone
  14.         strValue = vbNullChar & .Value & vbNullChar
  15.         If Len(strValue) > 2 Then
  16.           If InStr(strFind, strValue) > 0 Then
  17.             .Interior.Pattern = xlSolid
  18.             .Interior.Color = 255&
  19.           End If
  20.         End If
  21.       End With
  22.     Next
  23.   End With
  24. End Sub
複製代碼
世界那麼大,可我想去哪?

TOP

        靜思自在 : 人的心地是一畦田,土地沒有播下好種子,也長不出好的果實。 -
返回列表 上一主題