
Sub ricerca()
Dim a As Integer
Dim b As String
For a = 2 To 100
If Foglio1.Cells(32, 3).Value = Foglio3.Cells(a, 2).Value Then ' cerco il numero di telefono
Cells(a, 1).Value = b ' nominativo
MsgBox "risultato trovato" ' inserire il nominativo
Else
MsgBox "Cliente non Inserito"
End If
Next a
End Sub |
Option Explicit
Sub ricerca()
Dim a As Integer
Dim b As String
Dim blnFound As Boolean
For a = 2 To 100
If Foglio1.Cells(32, 3).Value = Foglio3.Cells(a, 2).Value Then ' cerco il numero di telefono
Cells(a, 1).Value = b ' nominativo
blnFound = True ''o = 1 o solo "blnfound"
Exit For '' ahi ahi ahi
End If
Next a
If Not blnFound Then
MsgBox "Cliente non Inserito"
Else
MsgBox "risultato trovato" ' inserire il nominativo
End If
End Sub
' p.s. STAI INVOLONTARIAMENTE USANDO IL CODENAME DEI FOGLI!!!
|
