Set oExcel = CreateObject("Excel.Application")
Set oWBook = oExcel.Workbooks.Open("C:/JX/WorkSpace/test.xls")
Set oSheet = oExcel.ActiveWorkbook.Worksheets("Sheet1")
oSheet.Activate
Set str_RequireText = oExcel.Cells.Find("dog")
If Not str_RequireText is Nothing Then
int_Row = str_RequireText.Row
int_Col = str_RequireText.Column
Reporter.ReportEvent micPass, "Find Value in Excel","MyPlace was found in Excel in Row: "&int_Row& "Column: "&int_Column
Else
Reporter.ReportEvent micFail, "Find Value in Excel","MyPlace was not found in Excel"
oExcel.Quit
Set oExcel = Nothing
ExitRun
End If
QTP Getting data from an excel using column names
最新推荐文章于 2025-12-01 10:02:13 发布
本文介绍如何使用VBA在Excel中查找指定文本并获取其位置信息,通过实例展示了如何激活工作簿、定位到特定的工作表,并利用Cells.Find方法找到目标文本。
1万+

被折叠的 条评论
为什么被折叠?



