|
本帖最后由 peteryhr 于 2024-6-20 09:34 编辑
功能1已经按需求做好。需求2:对你所说的顺序不太看得懂,原附件中已有做好的子程序,按对你所述的顺序理解加在代码中间了。顺序不对可以自己掉换一下。
Sub byPeteryhr()
Dim Dic As Object, arr, i&
Set Dic = CreateObject("Scripting.Dictionary")
arr = Sheet2.Range("A1:C" & Sheet2.Cells(Rows.Count, 2).End(xlUp).Row)
For i = 2 To UBound(arr)
If Dic.exists(arr(i, 2)) Then Dic(arr(i, 2)) = arr(i, 3)
Next
With Sheet1
.Range("A4:I" & .Cells(Rows.Count, 2).End(xlUp).Row).ClearContents
.Range("B1:B2,D1,F1").ClearContents
模块1.按钮1_Click
模块4.色号调用
模块5.按钮5_Click
模块6.按钮6_Click
arr = .Range("A4:I" & .Cells(Rows.Count, 2).End(xlUp).Row)
For i = 1 To UBound(arr)
If Dic.exists(arr(i, 2)) Then arr(i, 8) = Dic(arr(i, 2))
Next
.Range("A4").Resize(UBound(arr), UBound(arr, 2)) = arr
End With
Set Dic = Nothing
End Sub
|
评分
-
1
查看全部评分
-
|