Hi all,
I have this code in my application, its objective to find a part of code in a specific column
This code sometimes when i open my app. runs and sometimes doesn't
I don't know what the defect.
Sub Done() 'Default Option
'SpeedOn
On Error Resume Next
Dim Dishet As Worksheet
Dim v As Integer, LastRow As Integer
Dim M As String
Dim b, F
List_done.Clear
MM = textIC.Value 'target number
Set Dishet = Sheet1
With Dishet
.Activate
LastRow = .Cells(.Rows.Count, "H").End(xlUp).Row
Set b = .Range("H4:H" & LastRow).Find(MM) 'Target column
If Not b Is Nothing Then
F = b.Address
Do
If Application.WorksheetFunction.Search(M, b, 1) = 1 And _
b.Text = b.Offset(0, -6).Text & "/" & MM Then
List_done.ColumnCount = 10
List_done.AddItem b.Value
For i = 1 To 10
CC = Choose(i, -5, -4, -1, 1, 3, 4, 5, 8, 9)
List_done.List(v, i) = b.Offset(0, CC).Text
Next
List_done.List(v, 20) = b.Address
'List_done.ColumnHeads = True
List_done.ColumnWidths = "80;62;153;75;133;55;58;55;55;0"
v = v + 1
End If
Set b = .Range("H4:H" & LastRow).FindNext(b)
Loop While Not b Is Nothing And b.Address <> F
Else
MsgBox "There are no results for your search criteria, please try again", vbExclamation, "Error"
textIC.Text = ""
textIC.SetFocus
End If
End With
'SpeedOff
End Sub
Bookmarks