
Option Explicit
Sub CercaNomeCliente()
Dim a As Integer
Dim b As String
Dim blnFound As Boolean
For a = 2 To 1000
If Foglio3.Cells(a, 2).Value = Foglio1.Cells(32, 3).Value Then ' cerco il numero di telefono
b = Cells(a, 1).Value ' trovo il nominativo
blnFound = True ''o = 1 o solo "blnfound"
Exit For
End If
Next a
If Not blnFound Then
MsgBox "Cliente NON Inserito"
Else
MsgBox "RISULTATO TROVATO IL CLIENTE E'" & b 'il b è il nominativo
End If
End Sub |
Cambia: b = Cells(a, 1).Value in b = Cells(a, 2).Value 'visto che la ricerca la fai con il valore della seconda colonna |
Sub CercaNomeCliente2()
Dim telefono As Range
Set telefono = Foglio3.Columns(2).Find(Foglio1.[c32])
If Not telefono Is Nothing Then
MsgBox "NUMERO CORRISPONDENTE A: " & vbCrLf & Foglio3.Cells(telefono.Row, 1)
Else
MsgBox "Cliente NON Inserito"
End If
End Sub |
Option Explicit
Sub nomi()
MsgBox "Nome: " & Foglio1.Name & " Codename: " & Foglio1.CodeName & vbCrLf _
& "Nome: " & Foglio2.Name & " Codename: " & Foglio2.CodeName
End Sub |
Sub nomi2()
MsgBox "Nome: " & Sheets(1).Name & " Codename: " & Sheets(1).CodeName & vbCrLf _
& "Nome: " & Sheets(2).Name & " Codename: " & Sheets(2).CodeName
End Sub
|
