Microsoft 365 quand clic sur cellule, afficher son contenu dans un msgbox

Usine à gaz

XLDnaute Barbatruc
Supporter XLD
Bonsoir à toutes et à tous,

Dans mon fichier de travail, par volonté, la barre de formule n'est pas affichée.
Dans une cellule, j'ai tout un texte qui ne peut se voir en entier et pourtant, je peux avoir besoin de le voir.

Après réflexion "intense" lol, j'ai fait un ch'ti code qui affiche le contenu de ma cellule quand je clic dessus dans un msgbox :
VB:
Private Sub Worksheet_SelectionChange(ByVal r As Range)
If Not Intersect(r, Range("H6")) Is Nothing Then
MsgBox Range("h6")
End If
End Sub

Je souhaiterais juste pouvoir zoomer l'affichage du msgbox.
Auriez-vous la solution ?
Je joins le fichier test,
Avec mes remerciements,
Je vous souhaite une bonne fin de journée,
lionel:)
 

Pièces jointes

  • AfficheContenu_cellule.xlsm
    15 KB · Affichages: 22

Phil69970

XLDnaute Barbatruc
Bonjour Arthour973, Job75

Le Msgbox ne peux pas être zoomer mais tu peux afficher un commentaire à la place....
Comme ceci :

VB:
'Dans un module
Sub Commentaire()

Dim VarTaille As Byte
Dim VarTexte As String

VarTaille = Range("D3").Value                               'La cellule qui va indique la taille du commentaire
VarTexte = Range("H6").Value

With Range("H6")
    .ClearComments
    .AddComment
    .Comment.Visible = True
    .Comment.Text Text:=VarTexte                            '"C'est super:" & Chr(10) & "Test"   'Le texte du commentaire
    'On regle la taille de la police en fonction de la cellule D3 par exemple (à adapter)
    .Comment.Shape.OLEFormat.Object.Font.Size = VarTaille   'Taille police (ici valeur de la cellule D3
    
    .Comment.Shape.OLEFormat.Object.Font.Bold = True    'Police en gras
    .Comment.Shape.OLEFormat.Object.Font.ColorIndex = 5 'Couleur de la police
    .Comment.Shape.Fill.ForeColor.SchemeColor = 47      'Orange
    .Comment.Shape.TextFrame.AutoSize = True
End With
End Sub

'**********

'Dans le code de la feuille
Private Sub Worksheet_SelectionChange(ByVal r As Range)

If Not Intersect(r, Range("H6")) Is Nothing Then
    Commentaire
End If

End Sub

Cordialement
 

Staple1600

XLDnaute Barbatruc
Bonjour le fil, arthour973, job75, Phil69970

Histoire de remettre du gaz... ;)
(On fait de ces choses quand le confinement dure, dure...)
VB:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
With Target
    If .Address = "$H$6" Then
    .Font.Size = 36: .Font.Color = 255: .RowHeight = 60
    .ColumnWidth = 225: .Interior.Color = vbYellow
    Application.Goto Target, True
    Else
    Cells.Font.Size = 10: Cells.ColumnWidth = 10.71: Cells.Rows.AutoFit: [H6].ClearFormats
     ActiveWindow.ScrollRow = 1: ActiveWindow.ScrollColumn = 1
    End If
End With
End Sub
 

Staple1600

XLDnaute Barbatruc
Re

Si c'est possible, mais avec recours aux API Windows ;)
01ApiArthour973.gif

NB: 119 lignes de codes pour cette MsgBox
(qui au final fait ce que fait un MsgBox Standard: afficher un message)
 

Discussions similaires

Statistiques des forums

Discussions
312 196
Messages
2 086 101
Membres
103 116
dernier inscrit
kutobi87