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