请帮忙修改一vba代码程序
一工作簿里有6张工作表,有sheet21和另外5张
将5张工作表中如有和sheet21中字段相同的,就将数据放入sheet21中, 不知道程序代码错在那里, 求助各位
Sub yidong()
Dim ib&, t1, tr, tc,shtt as worksheet
set shtt=thisworkbook.sheets("Sheet21")
On Error Resume Next
tr = shtt.UsedRange.Rows.Count + 1
For ad = 2 To wb.Sheets.Count
With Sheets(ad)
For ib = 1 To .Cells(1, Columns.Count).End(1).Column
Set t1 = shtt.[1:1].Find(.Cells(1, ib).Value, , , 1)
If Not t1 Is Nothing Then
tc = t1.Column
.Cells(2, ib).Resize(.Cells(Rows.Count, ib).End(3).Row - 1).Copy shtt.Cells(tr, tc)
End If
Next
End With
Next
end sub
[解决办法]
for next循环 + find方法,代码就算能完全运行,速度也会让你想死的心都有
其实就你这个要求,直接调用vlookup等工作表查询类函数就行
[解决办法]
自己已经解决啦。。呵呵 谢谢你
[解决办法]
解决了就好,关注
[解决办法]
当您的问题得到解答后请及时结贴.
http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html
8、如何给分和结贴?
http://community.csdn.net/Help/HelpCenter.htm#结帖