|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub test()
Set sh = Sheets("Sheet1")
arr = sh.[a1].CurrentRegion
Set d = CreateObject("scripting.dictionary")
For i = 2 To UBound(arr)
If arr(i, 3) = "A" Then
If Not d.exists(arr(i, 1)) Then d(arr(i, 1)) = i
Else
Set Rng = sh.Range("A" & i & ":F" & i)
If d.exists(arr(i, 1)) Then
sh.Range("G" & d(arr(i, 1)) & ":L" & d(arr(i, 1))).Value = Rng.Value
Else
Rng.Offset(0, 6).Value = Rng.Value
End If
Rng.Value = ""
End If
Next
Set d = Nothing
End Sub |
|