Générer userform après clic su cellule

Bonjour à toutes et à tous,

Afin de générer un userform à la suite d'un clic sur une cellule non vide dans les colonnes 2 et 3, j'ai généré le code suivant :

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim ligne As Integer
Dim col As Integer

ligne = Me.Range("A:XFD").Find("lots", lookat:=xlWhole).Row
col = Me.Range("A:XFD").Find("lots", lookat:=xlWhole).Column

If Not Application.Intersect(Target, Range(Cells(ligne + 1, col), Cells(Rows.Count, col))) Is Nothing Then
If Not IsEmpty(Application.Intersect(Target, Range(Cells(ligne + 1, col), Cells(Rows.Count, col)))) Then
ajout_charges_app.Show

End If
End If

If Not Application.Intersect(Target, Range(Cells(ligne + 1, col - 1), Cells(Rows.Count, col - 1))) Is Nothing Then
If Not IsEmpty(Application.Intersect(Target, Range(Cells(ligne + 1, col - 1), Cells(Rows.Count, col - 1)))) Then
ajout_charges_imm.Show

End If
End If

End Sub

Est-il possible que le lancement de userform se fasse après le clic sur le contenu d'une cellule (comme si le contenu d'une cellule était un lien vers le userform) et non pas en cliquant sur la cellule?

Merci d'avance pour vos retours

Bonsoir,

vous pouvez mettre le contenu en lien hypertexte et utiliser ceci :

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    ajout_charges_app.Show
End Sub

@ bientôt

LouReeD

Bonjour,

Merci pour votre retour!

Comment puis-je faire pour, dans une colonne donnée et si la cellule n'est pas vide, mettre le contenu d'une cellule en lien hypertexte svp?

Voici le code que j'ai commencé à faire (mais qui ne marche pas, pour je ne sais quelle raison...):

Sub hypert()
Dim col As Integer
Dim ligne As Integer
Dim ligne_fin As Integer

col = Sheets("actifs").Range("A:XFD").Find("Libellé actif", lookat:=xlWhole).col
ligne = Sheets("actifs").Range("A:XFD").Find("Libellé actif", lookat:=xlWhole).Row
ligne_fin = Sheets("actifs").Cells(Rows.Count, col).End(xlUp).Row

For I = ligne + 1 To ligne_fin
If IsEmpty(Sheets("actifs").Cells(I, col - 1)) = False Then

ActiveSheet.Hyperlinks.Add Anchor:=Cells(I, col - 1)

End If
Next
End Sub
7codage.xlsm (89.98 Ko)

Eureka !

Sub hypert()

Dim col As Integer
Dim ligne As Integer
Dim ligne_fin As Integer

col = Sheets("actifs").Range("A:XFD").Find("lots", lookat:=xlWhole).Column
ligne = Sheets("actifs").Range("A:XFD").Find("lots", lookat:=xlWhole).Row + 1
ligne_fin = Sheets("actifs").Cells(Rows.Count, col).End(xlUp).Row

For I = ligne To ligne_fin

If Sheets("actifs").Cells(I, col - 1).Value <> "" Then

Sheets("actifs").Hyperlinks.Add Anchor:=Cells(I, col - 1), Address:=""

End If
Next
End Sub

Bonsoir,

Bravo à vous ! En espérant avoir un petit peu contribuer à l'avancée de vos travaux !

@ bientôt

LouReeD

Rechercher des sujets similaires à "generer userform clic"