
Private Sub CommandButton1_Click()
Dim i As Long
RAvvia:
userform1.Caption = "CERCA in cella"
TextBox1.SetFocus
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Text)
With ActiveSheet.Range("X2:AB65536, A2:d65536, e1:j65536")
If CheckBox2.Value = True Then lAt = 1 Else lAt = 2
If myPrimo Is Nothing Then
myK1 = 0
Set c = .Find(TextBox1.Text, LookIn:=xlValues, lookat:=lAt)
Else: Set c = .FindNext(myCorr)
End If
If c Is Nothing Then GoTo CkCmt
If Not myPrimo Is Nothing Then If c.Address = myPrimo.Address Then GoTo CkCmt
c.Select
If myPrimo Is Nothing Then Set myPrimo = c
Set myCorr = c: userform1.Caption = "TROVATO in cella"
End With
Exit Sub
CkCmt:
userform1.Caption = "CERCA in commento"
If myPrimo Is Nothing Then Set myPrimo = ActiveCell
If myCorr Is Nothing Then Set myCorr = ActiveCell
For i = myK1 + 1 To ActiveSheet.Comments.Count
Set Kmt = ActiveSheet.Comments(i)
If Not Application.Intersect(Kmt.Parent, Range("X2:AB65536, A2:B65536, e1:j65536")) Is Nothing Then
myFlag = 0
If CheckBox2.Value = True And UCase(Kmt.Text) = UCase(TextBox1.Text) Then myFlag = True
If CheckBox2.Value = False And Len(UCase(Kmt.Text)) > Len(Replace(UCase(Kmt.Text), UCase(TextBox1.Text), "")) Then myFlag = True
If myFlag = True Then
myK1 = i: Kmt.Parent.Select
userform1.Caption = "TROVATO in commento": Exit Sub
End If
End If
Next
FineKmt:
userform1.Caption = "------> FINE RICERCA"
Set myPrimo = Nothing
End Sub
|
Private Sub CommandButton6_Click()
Dim i As Long
RAvvia:
userform1.Caption = "CERCA in cella"
TextBox1.SetFocus
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Text)
With ActiveSheet.Range("X2:AB65536, A2:d65536, e1:j65536")
If CheckBox2.Value = True Then lAt = 1 Else lAt = 2
If myPrimo Is Nothing Then
myK1 = 0
Set c = .Find(TextBox1.Text, LookIn:=xlValues, lookat:=lAt)
Else: Set c = .FindNext(myCorr)
End If
If c Is Nothing Then GoTo CkCmt
If Not myPrimo Is Nothing Then If c.Address = myPrimo.Address Then GoTo CkCmt
c.Select
If myPrimo Is Nothing Then Set myPrimo = c
Set myCorr = c: userform1.Caption = "TROVATO in cella"
End With
Exit Sub
CkCmt:
userform1.Caption = "CERCA in commento"
If myPrimo Is Nothing Then Set myPrimo = ActiveCell
If myCorr Is Nothing Then Set myCorr = ActiveCell
For i = myK1 + 1 To ActiveSheet.Comments.Count
Set Kmt = ActiveSheet.Comments(i)
If Not Application.Intersect(Kmt.Parent, Range("X2:AB65536, A2:B65536, e1:j65536")) Is Nothing Then
myFlag = 0
If CheckBox2.Value = True And UCase(Kmt.Text) = UCase(TextBox1.Text) Then myFlag = True
If CheckBox2.Value = False And Len(UCase(Kmt.Text)) > Len(Replace(UCase(Kmt.Text), UCase(TextBox1.Text), "")) Then myFlag = True
If myFlag = True Then
myK1 = i: Kmt.Parent.Select
userform1.Caption = "TROVATO in commento": Exit Sub
End If
End If
FindPrevious |
Private Sub CommandButton6_Click()
With ActiveSheet.Range("X2:AB65536, A2:d65536, e1:j65536")
Set c = .FindPrevious(c)
c.Select
End With
End Sub |
Private Sub CommandButton6_Click()
With ActiveSheet.Range("X2:AB65536, A2:d65536, e1:j65536")
Set st = .FindPrevious(st)
st.Select
End With
End Sub
|
If CheckBox2.Value = True Then lAt = 1 Else lAt = 2
If myPrimo Is Nothing Then
myK1 = 0
Set c = .Find(TextBox1.Text, LookIn:=xlValues, lookat:=lAt)
Else: Set c = .FindNext(myCorr)
End If
If c Is Nothing Then GoTo CkCmt
If Not myPrimo Is Nothing Then If c.Address = myPrimo.Address Then GoTo CkCmt
c.Select
If myPrimo Is Nothing Then Set myPrimo = c
Set myCorr = c: userform1.Caption = "TROVATO in cella" |
If CheckBox2.Value = True Then lAt = 1 Else lAt = 2
If myPrimo Is Nothing Then
myK1 = 0
Set c = .Find(TextBox1.Text, LookIn:=xlValues, lookat:=lAt)
Else: Set c = .FindNext(myCorr)
End If
If c Is Nothing Then GoTo CkCmt
If Not myPrimo Is Nothing Then If c.Address = myPrimo.Address Then GoTo CkCmt
c.Select
If myPrimo Is Nothing Then Set myPrimo = c
Set myCorr = c: userform1.Caption = "TROVATO in cella" |
