T
tonio
Guest
Bonjour le forum
Je viens vous demander un petit coup de main pour une erreur que je ne comprends pas.
Je débute en VBA et tout n’est pas simple.
J’ai un USF avec une Listbox1 et un Textbox7 ou j’ai placée code suivant :
Private Sub TextBox7_Change()
Dim WS As Worksheet
Dim PLAGE As Range, CELL As Range
Dim RECHERCHE As String, ADRESSE As String
Dim LIGNE As Variant
Dim C As Object
RECHERCHE = TextBox7
If RECHERCHE = "" Then Exit Sub
For Each WS In Worksheets
LIGNE = Worksheets(WS.Name).Range("" & "B" & "65536").End(xlUp).Row
Set PLAGE = Worksheets(WS.Name).Range("" & "B" & "2:" & "B" & LIGNE)
With PLAGE
Set C = .Find(RECHERCHE)
If Not C Is Nothing Then
ADRESSE = C.Address
Do
ListBox1.AddItem C
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address
End If
End With
Next WS
End Sub
Mais lorsque je le sélectionne et tape une lettre il me met une ERREUR 70, accès refuse.
Et il possible que du fait que j’ai le code suivant sur ma Listbox1, ça me bloque la recherche.
Private Sub ListBox1_Click()
Dim PLAGE As Range
Dim CELL As Range
Set PLAGE = Worksheets("ListingClient").Range("B5:B" & DerLigne)
For Each CELL In PLAGE
If CELL.Value = ListBox1.Value Then
TextBox1 = CELL.Offset(0, 1).Value
TextBox2 = CELL.Offset(0, 2).Value
TextBox3 = CELL.Offset(0, 3).Value
TextBox4 = CELL.Offset(0, -1).Value
TextBox5 = CELL.Offset(0, 4).Value
TextBox6 = CELL.Offset(0, 8).Value
TextBox8 = CELL.Offset(0, 9).Value
End If
Next CELL
CommandButton1.Visible = True
End Sub
Quelqu'un peut-il m’aider
Merci d’avance
AA ++ Tonio............
Je viens vous demander un petit coup de main pour une erreur que je ne comprends pas.
Je débute en VBA et tout n’est pas simple.
J’ai un USF avec une Listbox1 et un Textbox7 ou j’ai placée code suivant :
Private Sub TextBox7_Change()
Dim WS As Worksheet
Dim PLAGE As Range, CELL As Range
Dim RECHERCHE As String, ADRESSE As String
Dim LIGNE As Variant
Dim C As Object
RECHERCHE = TextBox7
If RECHERCHE = "" Then Exit Sub
For Each WS In Worksheets
LIGNE = Worksheets(WS.Name).Range("" & "B" & "65536").End(xlUp).Row
Set PLAGE = Worksheets(WS.Name).Range("" & "B" & "2:" & "B" & LIGNE)
With PLAGE
Set C = .Find(RECHERCHE)
If Not C Is Nothing Then
ADRESSE = C.Address
Do
ListBox1.AddItem C
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address
End If
End With
Next WS
End Sub
Mais lorsque je le sélectionne et tape une lettre il me met une ERREUR 70, accès refuse.
Et il possible que du fait que j’ai le code suivant sur ma Listbox1, ça me bloque la recherche.
Private Sub ListBox1_Click()
Dim PLAGE As Range
Dim CELL As Range
Set PLAGE = Worksheets("ListingClient").Range("B5:B" & DerLigne)
For Each CELL In PLAGE
If CELL.Value = ListBox1.Value Then
TextBox1 = CELL.Offset(0, 1).Value
TextBox2 = CELL.Offset(0, 2).Value
TextBox3 = CELL.Offset(0, 3).Value
TextBox4 = CELL.Offset(0, -1).Value
TextBox5 = CELL.Offset(0, 4).Value
TextBox6 = CELL.Offset(0, 8).Value
TextBox8 = CELL.Offset(0, 9).Value
End If
Next CELL
CommandButton1.Visible = True
End Sub
Quelqu'un peut-il m’aider
Merci d’avance
AA ++ Tonio............