A voir également:
- Dernière ligne de texte d'une cellule à mettre en gras
- Partage de photos en ligne - Guide
- Excel cellule couleur si condition texte - Guide
- Mettre en gras sur whatsapp - Guide
- Aller à la ligne dans une cellule excel - Guide
- Mètre en ligne - Guide
2 réponses
bonjour,
j'ai ce petit bout de macro qui fonctionne mais celà impose de renter les textes en doublecliquant sur la cellule.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim text, ntext As String
Dim l, nl As Integer
text = ActiveCell
l = Len(text)
ntext = InputBox("nouveau texte")
nl = Len(ntext)
ActiveCell.FormulaR1C1 = text & Chr(10) & ntext
Selection.Font.Bold = False
With ActiveCell.Characters(Start:=l + 1, Length:=nl + 1).Font
.FontStyle = "Gras"
End With
End Sub
j'ai ce petit bout de macro qui fonctionne mais celà impose de renter les textes en doublecliquant sur la cellule.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim text, ntext As String
Dim l, nl As Integer
text = ActiveCell
l = Len(text)
ntext = InputBox("nouveau texte")
nl = Len(ntext)
ActiveCell.FormulaR1C1 = text & Chr(10) & ntext
Selection.Font.Bold = False
With ActiveCell.Characters(Start:=l + 1, Length:=nl + 1).Font
.FontStyle = "Gras"
End With
End Sub
Bonjour
Un exemple
https://www.cjoint.com/?3Ltp1WeStks
Cdlmnt
Option Explicit ' plages à traiter - à modifier selon la configuration Const plage1 = "A1:A10" Const plage2 = "C1:C10" Private Sub Worksheet_Change(ByVal Target As Range) Dim pl As Range, nbvblf As Long, rvblf As Long, s As String ' compléter avec les plages à traiter Set pl = Union(Range(plage1), Range(plage2)) If Not Intersect(Target, pl) Is Nothing Then s = Target.Value s = StrReverse(s) rvblf = InStr(1, s, vbLf) If rvblf = 0 Then Target.Font.Bold = True Else rvblf = Len(s) - rvblf + 1 Target.Characters(Start:=1, Length:=rvblf - 1).Font.Bold = False Target.Characters(Start:=rvblf + 1, Length:=Len(s) - rvblf).Font.Bold = True End If End If End Sub
Un exemple
https://www.cjoint.com/?3Ltp1WeStks
Cdlmnt