XL 2016 Afficher les images en fonction des valeurs definies du top, left, width et height

melltel

XLDnaute Junior
bonjour, svp je reviens pour solliciter votre aide.
enfet je ne parviens pas a positionner mes deux images au même endroit sur le UserForm. Ceci avec les valeurs définies dans un petit tableau sur la feuille excel. ( ex: on consulte le tableau , ses valeurs . et en fonction du top, left... les images se positionnent directement )

merci pour votre aide
voici mon fichier
 

Pièces jointes

  • Classeur1.xlsm
    34.3 KB · Affichages: 15

danielco

XLDnaute Accro
Bonjour,

Comme ceci ?

VB:
Private Sub UserForm_Click()

Dim Im As Integer
Im = Range("C9")
 If Im = 1 Then
    Image1.Visible = True
    Image2.Visible = False
 Else
    If Im = 2 Then
       Image1.Visible = False
       Image2.Visible = True
    End If
 
 End If
 Me.Image1.Left = [Feuil1!C6]
 Me.Image1.Top = [Feuil1!C5]
 Me.Image1.Height = [Feuil1!C7]
 Me.Image1.Width = [Feuil1!C8]
 Me.Image2.Left = [Feuil1!C6]
 Me.Image2.Top = [Feuil1!C5]
 Me.Image2.Height = [Feuil1!C7]
 Me.Image2.Width = [Feuil1!C8]
End Sub

Daniel
 

melltel

XLDnaute Junior
Bonjour,

Comme ceci ?

VB:
Private Sub UserForm_Click()

Dim Im As Integer
Im = Range("C9")
 If Im = 1 Then
    Image1.Visible = True
    Image2.Visible = False
 Else
    If Im = 2 Then
       Image1.Visible = False
       Image2.Visible = True
    End If
 
 End If
 Me.Image1.Left = [Feuil1!C6]
 Me.Image1.Top = [Feuil1!C5]
 Me.Image1.Height = [Feuil1!C7]
 Me.Image1.Width = [Feuil1!C8]
 Me.Image2.Left = [Feuil1!C6]
 Me.Image2.Top = [Feuil1!C5]
 Me.Image2.Height = [Feuil1!C7]
 Me.Image2.Width = [Feuil1!C8]
End Sub

Daniel
bonjour Daniel.
Merci. je ne sais pas si chez toi ca prend, mais chez moi ca ne marche pas.
 

melltel

XLDnaute Junior
c
Bonjour,

Comme ceci ?

VB:
Private Sub UserForm_Click()

Dim Im As Integer
Im = Range("C9")
 If Im = 1 Then
    Image1.Visible = True
    Image2.Visible = False
 Else
    If Im = 2 Then
       Image1.Visible = False
       Image2.Visible = True
    End If
 
 End If
 Me.Image1.Left = [Feuil1!C6]
 Me.Image1.Top = [Feuil1!C5]
 Me.Image1.Height = [Feuil1!C7]
 Me.Image1.Width = [Feuil1!C8]
 Me.Image2.Left = [Feuil1!C6]
 Me.Image2.Top = [Feuil1!C5]
 Me.Image2.Height = [Feuil1!C7]
 Me.Image2.Width = [Feuil1!C8]
End Sub

Daniel
c'est comme un appel de manière automatik, les valeurs du tableau. merci
 

Discussions similaires

Statistiques des forums

Discussions
312 082
Messages
2 085 169
Membres
102 804
dernier inscrit
edaguo