bonjour a tous voici le code que j ai trouver sur le fil de " freddy62 "
est il possible de l adapter pour qu il fonctionne aussi avec des cellules fusionner ?
Option Explicit
'Ti 07-07-04 : xlti@wanadoo.fr
Private Type TBord
LineStyle As Integer
Color As Long
Weight As Integer
End Type
Dim Size, Bords(1 To 6) As TBord
Dim LastCel As Range
Private Sub Reinit()
Dim B%
With LastCel
For B = 1 To .Borders.Count
.Borders(B).Color = Bords(B).Color
.Borders(B).Weight = Bords(B).Weight
.Borders(B).LineStyle = Bords(B).LineStyle
Next B
.Font.Size = Size
End With
End Sub
Private Sub Init()
Dim B%
With LastCel
For B = 1 To .Borders.Count
Bords(B).Color = .Borders(B).Color
Bords(B).LineStyle = .Borders(B).LineStyle
Bords(B).Weight = .Borders(B).Weight
Next B
Size = .Font.Size
.Font.Size = Size + 4
.Borders.LineStyle = xlContinuous
.Borders.Weight = xlThick
.Borders.Color = vbCyan
End With
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
'pour redonner à la cellule sélectionnée sa mise en forme originale
If Not LastCel Is Nothing Then Reinit
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
'ne concerne que la feuille nommée "saisie"
If Sh.Name <> "Feuil1" Or Target.Count > 1 Then Exit Sub
Application.ScreenUpdating = False
If Not LastCel Is Nothing Then Reinit
Set LastCel = Target
Init
Application.ScreenUpdating = True
End Sub
A+
est il possible de l adapter pour qu il fonctionne aussi avec des cellules fusionner ?
Option Explicit
'Ti 07-07-04 : xlti@wanadoo.fr
Private Type TBord
LineStyle As Integer
Color As Long
Weight As Integer
End Type
Dim Size, Bords(1 To 6) As TBord
Dim LastCel As Range
Private Sub Reinit()
Dim B%
With LastCel
For B = 1 To .Borders.Count
.Borders(B).Color = Bords(B).Color
.Borders(B).Weight = Bords(B).Weight
.Borders(B).LineStyle = Bords(B).LineStyle
Next B
.Font.Size = Size
End With
End Sub
Private Sub Init()
Dim B%
With LastCel
For B = 1 To .Borders.Count
Bords(B).Color = .Borders(B).Color
Bords(B).LineStyle = .Borders(B).LineStyle
Bords(B).Weight = .Borders(B).Weight
Next B
Size = .Font.Size
.Font.Size = Size + 4
.Borders.LineStyle = xlContinuous
.Borders.Weight = xlThick
.Borders.Color = vbCyan
End With
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
'pour redonner à la cellule sélectionnée sa mise en forme originale
If Not LastCel Is Nothing Then Reinit
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
'ne concerne que la feuille nommée "saisie"
If Sh.Name <> "Feuil1" Or Target.Count > 1 Then Exit Sub
Application.ScreenUpdating = False
If Not LastCel Is Nothing Then Reinit
Set LastCel = Target
Init
Application.ScreenUpdating = True
End Sub
A+