我正在尝试将你在ws4
中看到的E列和F列的每个ID进行分配...
...分别对应于我的wsOutput
中的K列和L列中的相应ID。
我的代码没有报错,但是没有任何反应。这是我做的第一个项目,如果问题比较简单,请见谅。
我也在网上查找了一些资料,发现:
'Previous Code
'wsOutput -> Filter Sheet - Worksheet (TARGET) ; ws4 = Search Skills - Worksheet (SOURCE)
Dim separator As String, PreviousResultCG As String, NewResultCG As String, PreviousResultCategory As String, NewResultCategory As String
If separator = "" Then separator = " , "
'lRowInput = ws4.Range("A" & Rows.Count).End(xlUp).row - from above
lRowOutput = wsOutput.Range("A4:A" & Rows.Count).End(xlDown).row
With ws4
'For each ID on the Source-Worksheet
For Each ID In .Range("A2:A" & lRowInput)
'Find the respective ID on Target-Worksheet
Set FindID = wsOutput.Range("A4:A" & lRowOutput).Find(what:=ID, LookIn:=xlValues, lookat:=xlWhole)
'Get all CG ID's for the supplier and add them to previously found ID's of that supplier
If FindID = ID Then
PreviousResultCG = wsOutput.Range("K" & FindID.row).value
NewResultCG = PreviousResultCG & separator & .Range("E" & ID.row)
wsOutput.Range("K" & ID.row).value = NewResultCG
PreviousResultCategory = wsOutput.Range("L" & FindID.row).value
NewResultCategory = PreviousResultCategory & separator & .Range("F" & ID.row)
wsOutput.Range("L" & FindID.row).value = NewResultCategory
End If
Next ID
End With
ID.Row
而不是FindID.Row
)。也许它们已经被添加了,但你看不见? - arcadeprecinct