您好
中的.Find method
就此主题提供了一些快速帮助
它总是循环回到它找到的同一个第一个单元格,现在使用.findnext
(第一个单元格地址)我得到一个错误,说明范围类的FindNext方法失败
到目前为止,我们非常感谢任何帮助:
Set objXLApp = CreateObject("Excel.Application")
Set EffR = objXLApp.Workbooks.Open("C:\Users\Daniel\Desktop\March Eff Report.xlsx")
objXLApp.Application.Visible = True
objXLApp.DisplayAlerts= False
Set CPS = EffR.Sheets(3)
Set MTDsum = EffR.Sheets(4)
Set DIMA1 = EffR.Sheets(5)
Set DIMA2 = EffR.Sheets(6)
Set CP2 = EffR.Sheets(7)
Set CP3 = EffR.Sheets(8)
Set AO500 = EffR.Sheets(9)
Set AO501 = EffR.Sheets(10)
DIMA1.Activate
findMe = "7001030025F"
Set rSearch = DIMA1.Range("A1")
Set rFound = rSearch.Find(findMe)
adrFirst = rFound.Address
'wscript.echo ""&adrFirst&""
rSearch.FindNext(adrFirst)
答案 0 :(得分:1)
几条评论:
码
Set rsearch = DIMA1.Range("A1")
Set rfound = rsearch.Find(findMe)
If Not rfound is nothing Then
wscript.echo "found"
adrFirst = rfound.Address
Do
Set rfound = rsearch.FindNext(rfound)
Loop While rfound.Address <> adrFirst
else
wscript.echo "not found"
End If