XL 2016 Application.Intersect

dede869

XLDnaute Occasionnel
Bonjour a vous, j'ai trouver cette formule,

Application.Intersect(Range("Test"), Range("Sample")).Select

Est il possible que le range ("Test") peut etre changer par la sélection que je fait dans un combobox1 et la mème chose pour l'autre par combobox2 .

Merci
 

Dranreb

XLDnaute Barbatruc
Bonsoir.
Je verrais bien un code à peu près comme ça :
VB:
Option Explicit
Private PlgDon As Range, PlgSel As Range, TSel(), L&

Private Sub UserForm_Initialize()
Set PlgDon = Feuil2.[D3:M134]
End Sub

Private Sub ListBox1_Click()
If ListBox2.ListIndex = -1 Then Exit Sub
ListBox2_Click
End Sub

Private Sub ListBox2_Click()
If ListBox1.ListIndex = -1 Then Exit Sub
Set PlgSel = PlgDon.Offset(11 * ListBox1.ListIndex, ListBox2.ListIndex).Resize(11, 1)
TSel = PlgSel.Value
For L = 1 To 11: Me("Textbox" & L + 11).Text = TSel(L, 1): Next L
End Sub

Private Sub CommandButton3_Click()
On Error Resume Next
For L = 1 To 11
   Err.Clear: TSel(L, 1) = CCur(Me("Textbox" & L + 11).Text)
   If Err Then TSel(L, 1) = Empty
   Next L
PlgSel.Value = TSel
End Sub

Private Sub CommandButton2_Click()
Unload Me
End Sub
 
Dernière édition:

Statistiques des forums

Discussions
312 167
Messages
2 085 901
Membres
103 026
dernier inscrit
NAT dan