0
今天早些時候我在這裏得到了這段代碼,只是試圖去適應它。我在線Set Rng =
上收到運行時錯誤13,我不太確定爲什麼(?)任何幫助表示讚賞。運行時錯誤13類型錯誤匹配VBA Excel 2010
Sub PlayMacro()
Dim Prompt As String
Dim RetValue As String
Dim Rng As Range
Dim RowCrnt As Long
Prompt = ""
With Sheets("Claims")
Do While True
RetValue = InputBox(Prompt & "Give me a value to look for")
'RetValue will be empty if you click cancel
If RetValue = "" Then
Exit Do
End If
' I do not wish to active the cell containing the required value.
' I want to know where it is.
Set Rng = .Range("Table1").Find(What:=RetValue, After:=.Range("Table1"), _
LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
If Rng Is Nothing Then
' The entered value could not be found
Prompt = "I could not find """ & RetValue & """"
Else
' The entered value was found
RowCrnt = Rng.Row
Prompt = "I found """ & RetValue & """ on row " & RowCrnt
End If
Prompt = Prompt & vbLf
Loop
End With
End Sub
感謝simoco。作品一種享受。 – JimQ