Bonjour à toutes et tous
Dans mes manips il m'arrive de vouloir tout connaître de l'état d'une cellule
Donc voilà une petite procédure qui rend bien service.
A vous de voir.
Dans mes manips il m'arrive de vouloir tout connaître de l'état d'une cellule
Donc voilà une petite procédure qui rend bien service.
A vous de voir.
Code:
Sub Test_Cellule()
Dim Ind, Fond, CoulText
Dim StyPolice, Taille, Valeur
Dim Form, Formule, Adr, Aligh
Valeur = ActiveCell.Value
Ind = ActiveCell.Interior.ColorIndex
Fond = ActiveCell.Font.Name
CoulText = ActiveCell.Font.ColorIndex
StyPolice = ActiveCell.Font.Bold
Taille = ActiveCell.Font.Size
Aligh = ActiveCell.HorizontalAlignment
Form = ActiveCell.NumberFormat '= "0.0%"
Adr = ActiveCell.Address
Formule = ActiveCell.Formula
If Aligh = -4131 Then Aligh = "Gauche"
If Aligh = -4108 Then Aligh = "Centré"
If Aligh = -4152 Then Aligh = "Droite"
'---------------------
MsgBox "Valeur Cellule active = " & vbTab & ": " & Valeur & vbNewLine _
& vbNewLine & "Couleur Index fond cellule = " & vbTab & ": " & Ind _
& vbNewLine & "Nom du Font (Police) = " & vbTab & ": " & Fond _
& vbNewLine & "Couleur du Texte = " & vbTab & vbTab & ": " & CoulText _
& vbNewLine & "Style police (Bold) = " & vbTab & vbTab & ": " & StyPolice _
& vbNewLine & "Taille Police (size) = " & vbTab & vbTab & ": " & Taille _
& vbNewLine & "Alignement H = " & vbTab & vbTab & ": " & Aligh _
& vbNewLine & "Format cellule = " & vbTab & vbTab & ": " & Form _
& vbNewLine & "Adresse cellule = " & vbTab & vbTab & ": " & Adr _
& vbNewLine & "Formule cellule = " & vbTab & vbTab & ": " & Formule
End Sub
[\code]
A+
Jean-Paul