Sub CommandButton1_Click()
c = 0
For Each e In Sheets
e.Cells(2, 30) = 0
If e.Cells(2, 15) = Sheet10.Cells(2, 4) Then
Sheet10.Cells(1, 1) = e.Cells(2, 15)
c = 1
Exit For
End If
Next e
If c = 0 Then
Sheet10.Cells(1, 1) = "No such player"
End If
End Sub
我目前正在建設一個按鈕,用於搜索在Sheet10.Cells值片(2,4)通過每個sheet.When它發現等於它本身的價值將其返回在該值Sheet10.Cells(1,1)。如果沒有找到該值,則將'No such player'返回到Sheet10.Cells(1,1)。 請檢查代碼,不知道哪裏出錯。它似乎永遠不會遍歷所有表。循環每一個擅長使用VBA
不工作..... – honesty1997
顯示一些錯誤或仍然不停止在你想要的工作表上? – Limak
哦!它的工作原理!謝謝! 我剛剛重新打開文件幾次。 – honesty1997