程序就是分割一串字符,然后用其中一个字符串“NEW-REJ-HK“”作为find函数的查找关键值Sub test_click()textline = "TC_NO=1,Action=NEW-REJ-HK ,Case=0497 ,Order_ID=YYY1,Result=Fail"textline = Replace(textline, "=", ",")textline = Split(textline, ",")myrow = Workbooks("DBMTS_RTVM_SCFR_April_Release.xls").Sheets("Regression Test").Cells.Find(what:=textline(3), LookIn:=xlValues, lookat:=xlWhole).RowEnd Sub运行报错run-time erro '91' :Object variable or with block varible not set
1 回答
一只萌萌小番薯
TA贡献1795条经验 获得超7个赞
Sub test_click() Dim x, y textline = "TC_NO=1,Action=NEW-REJ-HK ,Case=0497 ,Order_ID=YYY1,Result=Fail" textline = Replace(textline, "=" , "," ) textline = Split(textline, "," ) Cells(1, 1) = textline(3) myrow = Sheets( "Sheet4" ).Cells.Find(textline(3), LookIn:=xlValues, lookat:=xlWhole).Row MsgBox myrow End Sub |
终于找到问题了;
你表中单元格的值,肯定不完全等于textline(3),(NEW-REJ-HK
)因为我测试了用我这个办法就可以;
- 1 回答
- 0 关注
- 185 浏览
添加回答
举报
0/150
提交
取消