Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 2 Then
Target.Offset(, -1).Font.Color = vbRed
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal target As Range)
[A:A].FormatConditions.Delete 'RAZ
If Intersect(ActiveCell, Range("B2:B" & Rows.Count)) Is Nothing Then Exit Sub
ActiveCell(1, 0).FormatConditions.Add xlExpression, Formula1:="=1" 'création de la MFC
ActiveCell(1, 0).FormatConditions(1).Interior.ColorIndex = 44 'orange
End Sub
Private Sub Worksheet_Change(ByVal target As Range)
With [A1].CurrentRegion
If .Rows.Count > 1 Then
With .Offset(1).Resize(.Rows.Count - 1)
.Columns(1).Interior.Color = RGB(231, 230, 230) 'gris clair
.Borders.Weight = xlThin 'bordures
End With
End If
'---RAZ en dessous---
With .Offset(.Rows.Count).Resize(Rows.Count - .Rows.Count)
.Interior.ColorIndex = xlNone
.Borders.LineStyle = xlNone
End With
End With
End Sub
MerciBonsoir
Sans MFC mais avec du VBA
(dans le code de la feuille concernée)
VB:Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Column = 2 Then Target.Offset(, -1).Font.Color = vbRed End If End Sub
C'est super!!! .Merci le tout puissant Job75Pour ce qui est de la couleur en colonne A et des bordures on peut ajouter cette macro :
Fichier (2).VB:Private Sub Worksheet_Change(ByVal target As Range) With [A1].CurrentRegion If .Rows.Count > 1 Then With .Offset(1).Resize(.Rows.Count - 1) .Columns(1).Interior.Color = RGB(231, 230, 230) 'gris clair .Borders.Weight = xlThin 'bordures End With End If '---RAZ en dessous--- With .Offset(.Rows.Count).Resize(Rows.Count - .Rows.Count) .Interior.ColorIndex = xlNone .Borders.LineStyle = xlNone End With End With End Sub