Bonjour,
Quelqu'un aurait une idee comment fusionner deux macros worksheet_change car separement sur une meme feuille cela ne marche pas et me renvoi un message d erreur. Si quelqu un aurait la solution je suis preneur.
Merci a tous.
Quelqu'un aurait une idee comment fusionner deux macros worksheet_change car separement sur une meme feuille cela ne marche pas et me renvoi un message d erreur. Si quelqu un aurait la solution je suis preneur.
Merci a tous.
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
k = 0
For i = 208 To 300
For j = 25 To 300
If Application.WorksheetFunction.CountBlank(Cells(i, j)) = 0 Then
If Cells(i, j) <> Cells(i, j - 1) Then
k = k + 1
End If
If 2 + k > 56 Then
k = 1
ElseIf (2 + k = 11) Or (2 + k = 25) Then
k = k + 1
End If
Cells(i, j).Interior.ColorIndex = 2 + k
Else
Cells(i, j).Interior.ColorIndex = 2
End If
Next j
Next i
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Not Application.Intersect(Target, [M6:M205]) Is Nothing Then
Call macro_tri
End If
Sub macro_tri()
ActiveWorkbook.Worksheets("prod").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("prod").Sort.SortFields.Add Key:=Range("G6:G205"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
ActiveWorkbook.Worksheets("prod").Sort.SortFields.Add Key:=Range("M6:M205"), _
SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("prod").Sort
.SetRange Range("B5:V205")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub