Excel 2003 de çalışan kod 2007 de Run-time error 6 overflow hatası veriyor

Katılım
25 Temmuz 2011
Mesajlar
18
Excel Vers. ve Dili
Türkçe 2003
Aşağıda yazılı kod, Excel 2003 de Sayfalarda geçen kelimeleri bulup kısa yolunu yazdırıyor. Ancak Excel 2007 de aynı işlemi yapmıyor. "Run-time error 6 overflow" hatası veriyor. Kırmızı ile işaretli yerdeki hatayı nasıl düzeltebilirim. İlgili arkadaşlara teşekkür ederim...

Kod:
Private Sub CommandButton1_Click()
 
    Dim c As Range, Adr As Variant, sat As Long, sonhcr As Range
    Dim i As Integer, adres As String
    Unprotect
    Application.ScreenUpdating = False
    Application.Calculation = xlManual
    Sheets("Ara").Select
    If Range("I2") = "" Then MsgBox "Aranacak Değeri Girin": Exit Sub
    
    sat = 5: Range("J" & sat, "J" & Rows.Count).ClearContents
    For i = 1 To Worksheets.Count
      If Not Sheets(i).Name = "Ara" Then
        With Sheets(i).Cells
          [COLOR="Red"]Set sonhcr = .Cells(.Cells.Count)[/COLOR]
          Set c = Sheets(i).Range("B2:B65536").Find(Range("I2").Value, , LookAt:=xlPart)
            If Not c Is Nothing Then
              Adr = c.Address
                Do
                  adres = Sheets(i).Name & "!" & c.Address
                  ActiveSheet.Hyperlinks.Add Cells(sat, "J"), "", adres, adres
                  sat = sat + 1
                Set c = .FindNext(c)
                Loop While Not c Is Nothing And c.Address <> Adr
            End If
        End With
      End If
    Next i
    Protect
    Set sonhcr = Nothing: Set c = Nothing
    Application.Calculation = xlAutomatic
    Application.ScreenUpdating = True
    MsgBox "Listeleme Tamamdır", , "EXCEL"
         
End Sub
 
Katılım
25 Temmuz 2011
Mesajlar
18
Excel Vers. ve Dili
Türkçe 2003
Nedenini bilmemekle beraber, kodda ki sorun çözüldü.
Kod içerisinde, aşağıdaki satırı işlemden kaldırınca, kod normal çalıştı.
Kod, Aşağıdaki adreste bulunan dosyadan alıntıdır.
Dosyayı Excel 2007 de kullanıp da düzeltmek isteyen, veya ilgilenen arkadaşlar için bu bilgiyi yazıyorum.

http://www.excel.web.tr/f135/kura-y-kerimin-turkce-mealinde-arama-t108973.html


'Set sonhcr = .Cells(.Cells.Count)
 
Üst