做了相当多的研究,我不能完全弄清楚这一点。这是一个工作簿,在工作表“报价”和工作表“导出”之间搜索
此脚本应
- 找到后,在报价表中开始搜索“PartNum”
- 下移2个单元格
- 复制新活动单元格中的值
- 在工作表“export”中搜索该值
- 找到后,将值向右偏移24个单元格
- 返回工作表“报价”
- 查找“交付周期”
- 向下移动2个单元格并粘贴值
我被卡住的零件,我没有按照我的意愿正确地写循环,我如何才能准确地循环每一次的Partnum和Leadtime下一行?有没有什么方法我可以添加,使它忽略如果一个零件没有找到,而不是错误?
'Find PartNum
Worksheets("Quote").Activate
Cells.Find(What:="PartNum").Offset(2, 0).Select
'Copy/search part Num
Dim str1 As String
Dim Cntr As Integer
Cntr = 0
Do While Cntr <= 650
Cntr = Cntr + 1
str1 = ActiveCell.Value
Selection.Copy
Worksheets("Export").Activate
ActiveCell.Select
Cells.Find(What:=str1, After:=ActiveCell, LookIn:= _
xlFormulas, lookat:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(0, 24).Range("A1").Select
Selection.Copy
Worksheets("Quote").Activate
'Find PartNum
Cells.Find(What:="Leadtime").Offset(2, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues
2条答案
按热度按时间jdg4fx2g1#
有些事情要尝试。
回复:我如何准确地循环一行降低每一次都为Parth编号和Leadtime?
回复:未找到部件
将“单元格.查找(What:=“PartNum”).偏移量(2,0).选择”替换为:
a5g8bdjr2#
根据我所能收集到的从您张贴的代码,但需要一些澄清围绕什么你正在做的“出口”表...