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
| sub double_clic_s()
Dim X As Integer
With ActiveWorkbook.VBProject.VBComponents("Feuil3").CodeModule
X = .CountOfLines
.InsertLines X + 1, "Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)"
.InsertLines X + 2, "If Not Intersect(Target,Range(""AN2:AN"" & Range(""AN65536"").End(xlUp).Row)) Is Nothing Then"
.InsertLines X + 3, "UserForm1.Show"
.InsertLines X + 4, "End If"
.InsertLines X + 5, "Cancel = True"
.InsertLines X + 6, "End Sub"
.InsertLines X + 7, "Private Sub UserForm_Initialize()"
.InsertLines X + 8, "ListBox1.MultiSelect = fmMultiSelectMulti"
.InsertLines X + 9, "ListBox1.List = Sheets(""liste des decisions corisq"").Range(""A2:A28"").Value"
.InsertLines X + 10, " a = Split(ActiveCell, "","")"
.InsertLines X + 11, "If UBound(a) > 0 Then"
.InsertLines X + 12, "For i = 0 To Me.ListBox1.ListCount - 1"
.InsertLines X + 13, "If Not IsError(Application.Match(Me.ListBox1.List(i), a, 0)) Then Me.ListBox1.Selected(i) = True"
.InsertLines X + 14, "Next i"
.InsertLines X + 15, "End If"
.InsertLines X + 16, "End Sub"
.InsertLines X + 17, "Private Sub CommandButton1_Click()"
.InsertLines X + 18, "For i = 0 To Me.ListBox1.ListCount - 1"
.InsertLines X + 19, "If Me.ListBox1.Selected(i) = True Then temp = temp & Me.ListBox1.List(i) & "", """
.InsertLines X + 20, "Next i"
.InsertLines X + 21, "ActiveCell = Left(temp, Len(temp) - 1)"
.InsertLines X + 22, "Unload Me"
.InsertLines X + 23, "End Sub"
End With
End Sub |