|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
老师,下面是遍历工作表的代码。现在问题是运行后提示“要求对象”
Sub 提项目名()
Dim sh, i%, j%, r%
Dim arr, brr
For Each sh In Sheets(Array("1L", "2L", "3L", "5L", "6L", "7L", "9L", "10L", "11L", "12L"))
r1 = Sheets("劳务").Cells(Rows.Count, 1).End(xlUp).Row
r2 = sh.Cells(Rows.Count, 1).End(xlUp).Row
Arr = Sheets("劳务").Range("A1:b" & r1)
Brr = sh.Range("A1:z" & r2)
For i = 1 To UBound(Arr)
For j = 1 To UBound(Brr)
If Arr(i, 1) = Brr(j, 2) Then
Brr(j, 26) = Arr(i, 2)
End If
Next
Next
'Next
sh.[A1].Resize(UBound(Brr), 26) = Brr ‘黄色,要求对象
End Sub
请老师,指正。谢谢
|
|