Error 2029 in VBA Excel

Solved
Mistral_13200 Posted messages 649 Status Member -  
Mistral_13200 Posted messages 649 Status Member -
Bonjour,

On a une cellule dans un classeur Excel nommée «Adr.Exp» qui utilise la fonction :
=RECHERCHEV(Nom_Plogic;Données!$M$4:$N$31;2;FAUX)
Cette fonction renvoie une adresse Internet du type xxx.yyy@SFR.fr.
Dans une macro, il y a le code suivant :
 Dim Adresse As Variant Adresse = [Adr_Exp]

Le problème rencontré est qu'à chaque fois que l'on essaie d'assigner la valeur de Adr.Exp à la variable Adresse, une erreur 2029 apparaît dans la fenêtre d'espion.
Des tentatives de changement de type de variable n'ont pas apporté de solution.
Quelqu'un aurait-il une idée, car je suis dans une impasse depuis hier après-midi.
Merci d'avance.
Cordialement,
Mistral

4 answers

  1. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
     
    Hello,

    I have a cell named “Adr.Exp
    Address = [Adr_Exp]

    . or _ you have to choose....

    eric
    0
  2. Mistral_13200 Posted messages 649 Status Member 4
     
    Hello Eric,

    Sorry, but it's just a typo in my first message.
    The cell is indeed named "Adr_Exp"

    And the variable is indeed looking for "Adr_Exp"
    0
  3. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
     
    Recheck that your name exists in a spreadsheet.
    0
  4. Mistral_13200 Posted messages 649 Status Member 4
     
    Another typo!
    A "-" instead of an "_"
    Thank you.
    Did you see my other question regarding the automatic insertion of a line?
    I know, after searching the forum, that you suggested a solution some time ago that could very well be what I'm looking for.
    This issue concerns the same file as the question about the Worksheet where you wonderfully helped me.
    0