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
| Dim Id_Project As Integer
Dim ColVisu(), LargeurCol(), Rng
Private Sub UserForm_Activate()
Dim Trouve As Range, PlageDeRecherche As Range
Dim Valeur_Cherchee As String, AdresseTrouvee As String
Dim debut As Long, fin As Long
Dim f As Worksheet
Id_Project = Sheets("DashBoard").Range("A1")
Set f = Sheets("Work-Packages")
Valeur_Cherchee = Id_Project
Set PlageDeRecherche = f.Columns(1)
Set Trouve = PlageDeRecherche.Find(what:=Valeur_Cherchee, LookAt:=xlWhole)
If Not Trouve Is Nothing Then
debut = Trouve.Row
Nb_WP = Application.WorksheetFunction.CountIf(f.Range("A:A"), Id_Project)
fin = debut + Nb_WP
Set Rng = f.Range("A" & debut & ":" & "A" & fin)
End If
ColVisu = Array(2, 3) ' Adapter
LargeurCol = Array(35, 457) ' Adapter
Me.List_WorkPackages.ColumnCount = UBound(ColVisu) + 1
Me.List_WorkPackages.ColumnWidths = Join(LargeurCol, ";")
Me.List_WorkPackages.List = Application.Index(Rng, Evaluate("Row(1:" & Rng.Rows.Count & ")"), ColVisu)
List_WP
End sub
Sub List_WP()
i = 0
x = Me.List_WorkPackages.Left + 8
Y = List_WorkPackages.Top - 12
For Each c In ColVisu
i = i + 1
Me("wplist" & i).Caption = Rng.Offset(-1).Item(1, c)
Me("wplist" & i).Top = Y
Me("wplist" & i).Left = x
Me("wplist" & i).Height = 24
Me("wplist" & i).Width = LargeurCol(i - 1)
x = x + LargeurCol(i - 1)
Next
End Sub |
Partager