Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Chercher et trouver

1 réponse
Avatar
Denys
Bonjour à tous

Dans la macro suivante, Excel recherche un nombre inscrit dans un textbox
sur une feuille Excel. Ce pendant, j'aimerais qu'Excel ne recherche que dans
la colonne G exclusivement, et non pas dans les autre colonnes.

Pourriez-vous me dire ce que je dois modifier?

Private Sub CommandButton1_Click()
If TextBox1.Value = "" Then Exit Sub
Dim Rg As Range
Application.ScreenUpdating = False
Nom = TextBox1.Text
Sheet1.Visible = True
Sheets("Database").Select
Set Rg = Cells.Find(What:=Nom, After:=Range("G2"), _
LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, MatchCase:=False)
If Rg Is Nothing Then
MsgBox "Account does not exist."
Unload LeadView
Sheet2.Select
Exit Sub
Else
Rg.Activate
End If

Unload LeadView
View.Show
Set Rg = Nothing
End Sub

Merci

Denys

1 réponse

Avatar
Denys
Bonjour Jean-François,

Merci infiniment... Tout est parfait

Bonne journée

Denys


Salut,
tu n'as qu'à remplacer cells.find par columns(7).find
Bonne journé


Bonjour à tous

Dans la macro suivante, Excel recherche un nombre inscrit dans un textbox
sur une feuille Excel. Ce pendant, j'aimerais qu'Excel ne recherche que dans
la colonne G exclusivement, et non pas dans les autre colonnes.

Pourriez-vous me dire ce que je dois modifier?

Private Sub CommandButton1_Click()
If TextBox1.Value = "" Then Exit Sub
Dim Rg As Range
Application.ScreenUpdating = False
Nom = TextBox1.Text
Sheet1.Visible = True
Sheets("Database").Select
Set Rg = Cells.Find(What:=Nom, After:=Range("G2"), _
LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, MatchCase:úlse)
If Rg Is Nothing Then
MsgBox "Account does not exist."
Unload LeadView
Sheet2.Select
Exit Sub
Else
Rg.Activate
End If

Unload LeadView
View.Show
Set Rg = Nothing
End Sub

Merci

Denys