akinkaraman
Member
One macro works in all excel files but it gives error in my excel file.
The error is "Run-time error '13': Type is mismatch
And debugged problem points to "If Alan.Value Like kelime Then"
This macro finds with search and it colors it.
Can you tell me why is this macro not working in my sheet and what should I do?
The error is "Run-time error '13': Type is mismatch
And debugged problem points to "If Alan.Value Like kelime Then"
This macro finds with search and it colors it.
Can you tell me why is this macro not working in my sheet and what should I do?
Code:
Sub Bul_ve_Renklendir()
Dim Alan As Range, say As Integer, kacinci As Integer
Dim Seçim
Seçim = InputBox("Seçiminizi Girin" & vbCrLf & "Bul ve Renklendir için 1" & vbCrLf & "Renklendirmeleri temizlemek için 2", "Seçiminiz", 1)
Select Case Seçim
Case "1"
kelime = InputBox("Aranacak Değeri Giriniz", "Bul ve Renklendir")
say = Len(kelime) - Len(Replace(kelime, "*", ""))
kacinci = InStr(1, kelime, "*")
kelime = Replace(kelime, "*", "")
ActiveSheet.UsedRange.Interior.Color = xlNone
For Each Alan In ActiveSheet.UsedRange
If say = 0 Then
kelime = kelime
ElseIf say = 1 And kacinci = 1 Then
kelime = "*" & kelime
ElseIf say = 1 And kacinci > 1 Then
kelime = kelime & "*"
ElseIf say > 1 Then
kelime = "*" & kelime & "*"
End If
If Alan.Value Like kelime Then Alan.Interior.ColorIndex = 6
Next
MsgBox "Bul ve Renklendir Tamamlandı !", vbInformation + vbOKOnly, "Sonuç"
Case "2"
Cells.Interior.ColorIndex = 0
MsgBox "Renklendirmeler Temizlendi !", vbInformation + vbOKOnly, "Sonuç"
Case Else
MsgBox "Herhangi bir işlem yapılmadı !", vbInformation + vbOKOnly, "Sonuç"
End Select
End Sub
Last edited: