1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
| Option Compare Text
Sub EnTête()
Dim i%, lbvis As Boolean
If lbxPrest.RowSource <> "" Then
lbvis = True
Else
lbvis = False
End If
For i = 1 To 3
Controls("lbPr" & i).Visible = lbvis
Next i
End Sub
Private Sub cbQuit_Click()
Unload Me
End Sub
Private Sub cbValid_Click()
Dim Cel As Range
Application.ScreenUpdating = False
'Range("A2:A24").Interior.ColorIndex = 2
Me.ListView1.ListItems.Clear
If ComboBox1 <> "" Then
' For i = Sheets.Count To 1 Step -1 'en mode de la dernière feuille à la première
For i = 1 To Sheets.Count 'en mode de la première feuille à la dernière
If Sheets(i).Name <> "Recherche" Then
For Each Cel In Sheets(i).Range("A1:Z" & Sheets(i).Range("F" & Application.Rows.Count).End(xlUp).Row)
' For Each Cel In Sheets(i).Range("A1:Z2000")
If Cel.Row > 3 And Cel <> "" Then
If Cel Like "*" & ComboBox1 & "*" Then
' Cel.Interior.ColorIndex = 43
UserForm1.ListView1.ListItems.Add , , Cel
UserForm1.ListView1.ListItems(UserForm1.ListView1.ListItems.Count).ListSubItems.Add , , Sheets(i).Name
UserForm1.ListView1.ListItems(UserForm1.ListView1.ListItems.Count).ListSubItems.Add , , Cel.Address
End If
End If
Next Cel
End If
Next i
End If
Application.ScreenUpdating = True
End Sub
Private Sub ListView1_DblClick()
Dim Feuille As String, Cellule As String
Feuille = UserForm1.ListView1.SelectedItem.ListSubItems(1)
Cellule = UserForm1.ListView1.SelectedItem.ListSubItems(2)
If Me.ListView1.ListItems.Count <> 0 Then
Sheets(Feuille).Activate
Sheets(Feuille).Range(Cellule).Activate
ActiveCell.EntireRow.Activate
End If
End Sub
Private Sub userform_initialize()
With Me.ListView1
With .ColumnHeaders
'Titres des colonnes
.Clear
'Ajout des colonnes
.Add , , "Liste", 300, lvwColumnLeft
.Add , , "Onglet", 116, lvwColumnLeft
.Add , , "Cellule", 90, lvwColumnLeft
End With
.View = lvwReport 'affichage en mode Rapport
.Gridlines = True 'affichage d'un quadrillage
.FullRowSelect = True 'Sélection des lignes comlètes
.LabelEdit = lvwManual
.HideSelection = False
.HotTracking = False
End With
End Sub |
Partager