|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 LMY123 于 2018-8-18 17:17 编辑
如果是新增的工号,则标题行相同,数据自动复制
- 'http://club.excelhome.net/thread-1221723-1-1.html
- Sub 选择相同列字段内容进行考贝_新增工号()
- Dim d As Object
- Set d = CreateObject("scripting.dictionary")
- Set d1 = CreateObject("scripting.dictionary")
- With Sheets("明细")
- arr = .[a1].CurrentRegion
- l = UBound(arr, 2)
- For i = 1 To l
- d(arr(1, i)) = i
- Next
- For i = 3 To UBound(arr)
- d1(arr(i, 1)) = i
- Next
- arr = Sheets("增加").[a1].CurrentRegion
- h = UBound(arr) - 1
- ReDim brr(1 To h, 1 To l)
-
- For i = 3 To UBound(arr)
- For j = 1 To UBound(arr, 2)
- If d.exists(arr(1, j)) Then
- If Not d1.exists(arr(i, 1)) Then
- brr(i - 2, d(arr(1, j))) = arr(i, j)
- End If
- End If
- Next
- Next
- .[a65536].End(3).Offset(1, 0).Resize(h, l) = brr
- End With
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|