mardi 10 décembre 2019

How to add several hyperlinks in VBA?

I'm trying to add a conditioned hyperlink in VBA - if one cell shows something (out of four possibilities), then the link is supposed to appear in another cell, on the same sheet, a few columns apart.

"Categorie" is the name of the cell on which content the condition is based. I've done this, but nothing appears on the sheet when I press play. Did I make a mistake ?

Sub Création_lien()

If Categorie = "Vocabulaire" Then
    ActiveSheet.Hyperlinks.Add Range("H6"), 
    "https://www.anglaisfacile.com/exercices/exercice-anglais-2/exercice-anglais-113622.php"
End If

End Sub

I went through it with F8, and it tells me that "Categorie" is empty. Here is my Sheet :

There is one list to choose from, and several possibilities that change according to what you choose, in the 4th to 6th column

enter image description here

As I have several answers that correspond to a same content in cell "Categorie", how can I add several links so they can appear in 9 cells ?

Aucun commentaire:

Enregistrer un commentaire