|
本帖最后由 sampsonpon 于 2024-3-15 17:26 编辑
如图,修改下代码:
- Sub CHECKTO()
- Application.ScreenUpdating = False
- '3/4改写:
- '如果"TO"工作表里K列有空白,那么
- '1、把K列是空白,所对应的的C列、D列不重复值写入到P2:Q列
- '================================================================================================================
- Dim s1$, s2$, s3$, s4$, s5$
- Dim dic, arr(), i&, iRow&, k, kk%
- With Sheet4
-
- iRow = .Range("A" & Rows.Count).End(3).Row
- kk = 0
- If iRow > 1 Then
- arr = .Range("A2:L" & iRow).Value
- Set dic = CreateObject("Scripting.Dictionary")
- For i = 1 To UBound(arr)
- If Trim(arr(i, 11)) = "" Then
- If Trim(arr(i, 3)) <> "" Then dic(CStr(arr(i, 3))) = ""
- End If
- Next i
-
- iRow = .Range("P" & Rows.Count).End(3).Row
- If iRow > 1 Then .Range("P2:P" & iRow).ClearContents
- If dic.Count > 0 Then
- k = dic.keys
- .Range("P2").Resize(dic.Count, 1) = Application.WorksheetFunction.Transpose(k)
-
- End If
- End If
- End With
-
- Application.ScreenUpdating = True
- End Sub
复制代码
|
|