Bonjour =E0 tous,
J'ai cr=E9=E9 une fonction qui va chercher le chemin d'une image et la
place en commentaire dans la cellule.
Mon probl=E8me est le suivant :
1=B0) Je souhaiterai que la cellule prenne la valeur du code (codeart)
qui est entr=E9 en param=E8tre
Voici le code :
Function photo(codeart As String)
'For Each C In Range("G15:G" & Range("G65536").End(xlUp).Row)
Dim url As String
Dim rep As Integer
Dim rep2 As String
Dim codeart2 As String
With monComment .Shape.Fill.UserPicture url .Value = codeart2 .Comment.Shape.Width = 200 .Comment.Shape.Height = 200 'MsgBox (b.Height) 'MsgBox (b.Width) End With End Function
Bonsoir,
Pour répondre à ta première question, dans ta fonction, avant le End
Sub, ajoute :
photo = codeart
Pour ta deuxième question, c'est normal puisque tu ajoute un
commentaire à la cellule active
Je ferais plutot une fonction avec deux paramètres :
Function photo(codeart As String, adr As Range)
que tu appelle dans Excel ainsi :
=photo("1234567890";A1)
Puis à la place de
With Range(ActiveCell.Address)
je mettrais
With adr
Cordialement,
F.
Function photod(codeart As String, adr As Range)
Dim url As String
Dim rep As Integer
Dim rep2 As String
Dim codeart2 As String
Dim monComment As Comment
With monComment
.Shape.Fill.UserPicture url
.Value = codeart2
.Comment.Shape.Width = 200
.Comment.Shape.Height = 200
'MsgBox (b.Height)
'MsgBox (b.Width)
End With
End Function
With monComment .Shape.Fill.UserPicture url .Value = codeart2 .Comment.Shape.Width = 200 .Comment.Shape.Height = 200 'MsgBox (b.Height) 'MsgBox (b.Width) End With End Function