Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Recup. valeur cellule dans un Label

2 réponses
Avatar
cphil
Bonsoir/jour, joyeux Noël,

Comment récupérer la valeur de Sheet("Feuil1!").Range("A1")
dans la propiété Caption d'un Label.
Merci A+.

--
-cphil-

2 réponses

Avatar
François Picalausa
"cphil" <cazenave.(suffitspam) a écrit dans le message
de news:
Comment récupérer la valeur de Sheet("Feuil1!").Range("A1")
dans la propiété Caption d'un Label.



Bonjour/soir,

Essaye ceci:
Private Sub CommandButton1_Click()
Dim objMyRange As Range
Set objMyRange = ThisWorkbook.Sheets("Feuil1").Range("A1")

With objMyRange
Label1.Caption = .Text
Label2.Caption = .Formula
Label3.Caption = .Value
End With
End Sub

Je te réfère à l'aide pour plus d'informations sur es spécificités de
chacune des propriétés de l'objet range:
http://msdn.microsoft.com/library/en-us/vbaxl10/html/xlobjRange.asp
http://msdn.microsoft.com/library/en-us/vbaxl10/html/xlprovalue.asp
http://msdn.microsoft.com/library/en-us/vbaxl10/html/xlproformula.asp
http://msdn.microsoft.com/library/en-us/vbaxl10/html/xlprotext.asp

--
François Picalausa (MVP VB)
FAQ VB : http://faq.vb.free.fr
MSDN : http://msdn.microsoft.com
Avatar
cphil
Bonjour,

Merci François, grâce à ta réponse qui va au-delà de la question
posée, j'en apprends davantage plus rapidement.

A+
--
-cphil-

"François Picalausa" a écrit dans le message de
news:
"cphil" <cazenave.(suffitspam) a écrit dans le message
de news:
> Comment récupérer la valeur de Sheet("Feuil1!").Range("A1")
> dans la propiété Caption d'un Label.

Bonjour/soir,

Essaye ceci:
Private Sub CommandButton1_Click()
Dim objMyRange As Range
Set objMyRange = ThisWorkbook.Sheets("Feuil1").Range("A1")

With objMyRange
Label1.Caption = .Text
Label2.Caption = .Formula
Label3.Caption = .Value
End With
End Sub

Je te réfère à l'aide pour plus d'informations sur es spécificités de
chacune des propriétés de l'objet range:
http://msdn.microsoft.com/library/en-us/vbaxl10/html/xlobjRange.asp
http://msdn.microsoft.com/library/en-us/vbaxl10/html/xlprovalue.asp
http://msdn.microsoft.com/library/en-us/vbaxl10/html/xlproformula.asp
http://msdn.microsoft.com/library/en-us/vbaxl10/html/xlprotext.asp

--
François Picalausa (MVP VB)
FAQ VB : http://faq.vb.free.fr
MSDN : http://msdn.microsoft.com