Bonsoir , j'ai un code que je veux déplacer dans un module afin de l'utiliser sur plusieurs feuilles.
Ce code fonctionne bien quand il est inscrit dans les feuilles , mais je le déplace dans un module j'ai un problème d'appel de procédure ( apparament sur Target) , alors au secours !!!!!
Ce code fonctionne bien quand il est inscrit dans les feuilles , mais je le déplace dans un module j'ai un problème d'appel de procédure ( apparament sur Target) , alors au secours !!!!!
Code:
Option Explicit
Dim MaValeur As Variant
Dim Target As Range
Dim cel As Variant
Dim cell As Variant
Dim Col As Variant
Dim n As Variant
Dim flag As Boolean
'<<<<<<<<<<<<< pour tous les N° feuilles R V B J <<<<<<<<<<<<<<<<<<<<<
Sub Toute_la_feuille_affectations() 'Controle Affectations de toute la feuille
Application.ScreenUpdating = False
If flag Then Exit Sub
flag = True
If flag And Not Intersect(Target, Range("C6:C26,H6:H30,M6:M37,R6:R39")) Is Nothing Then
Target.Offset(0, 1) = MaValeur
End If
flag = False
If flag Then Exit Sub
flag = True
Col = Array("C", "H", "M", "R")
For n = 0 To UBound(Col)
For Each cel In Range(Col(n) & "1:" & Col(n) & Range(Col(n) & "65536").End(xlUp).Row)
If cel.Value <> "" And cel.Font.Color <> 8421504 Then
For Each cell In Sheets("test").Range("C7:C300")
If cel.Value = cell.Value Then
cell.Copy Destination:=cel
cel.Borders.LineStyle = 7
End If
Next cell
End If
Next cel
Next n
End Sub