2014-01-28 2 views
0

이 코드를 오늘 여기에서 가져 와서이를 적용하려고했습니다. 나는 런타임 오류 13 라인에 Set Rng =을 받고 있는데, 나는 왜 확실하지 않다. (?) 어떤 도움을 주셔서 감사합니다. 라인 Set Rng = .Range("Table1").Find(...After:=.Range("Table1"),을 삭제런타임 오류 13 유형 Mis-Match 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 

답변

2

시도 :

Set Rng = .Range("Table1").Find(What:=RetValue, _ 
     LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _ 
     SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False) 
+1

감사 simoco. 치료를해라. – JimQ

관련 문제