Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

erreur sur élaboration d'un code

1 réponse
Avatar
ALF
Bonjour,

j'obtiend ce message d'erreur : erreur de compilation:
nombre d'arguments incorrect ou affectation de propriété incorrecte

et sur le code, l' erreur se positionne sur RANGE( au niveau de "Départs
ACT" Et Apparemment,le 1er FOR EACH sur("Taux de siren") a bien passé..

Par contre sur le 2eme FOR EACH sur("Départs ACT") ne passe pas et bloque a
ce niveau la..

For Each c In Range("B2:Q73")
If Left(c, 11) = "Départs ACT" Then

l'erreur se positionne ici-------->RANGE(c.Offset(0, 1), c.Offset(0, 2),
c.Offset(0, 4), c.Offset(0, 5)).Select
pouvez vous resoudre ce probleme..je vous laisse ci joint le code en question.

Merci de votre soutien

Dim FeuilleActive As Worksheet
Application.ScreenUpdating = False
Set FeuilleActive = ActiveSheet
Dim c As Range
For Each c In Range("B2:Q73")
If Left(c, 13) = "Taux de siren" Then
Range(c.Offset(0, 3), c.Offset(0, 4)).Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Else
Range(c.Offset(0, 3), c.Offset(0, 4)).Select
Selection.Interior.ColorIndex = xlNone
End If
Next c
For Each c In Range("B2:Q73")
If Left(c, 11) = "Départs ACT" Then
Range(c.Offset(0, 1), c.Offset(0, 2), c.Offset(0, 4), c.Offset(0,
5)).Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Else
Range(c.Offset(0, 3), c.Offset(0, 4)).Select
Selection.Interior.ColorIndex = xlNone
End If
Next c
For Each c In Range("B2:Q73")
If Left(c, 26) = "Nombre de dossiers par ETP" Or Left(c, 24) = "Nombre
de d'avis par ETP" Then
Range(c.Offset(0, 1), c.Offset(0, 4), c.Offset(0, 5)).Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Else
Range(c.Offset(0, 3), c.Offset(0, 4)).Select
Selection.Interior.ColorIndex = xlNone
End If
Next c
For Each c In Range("B2:Q73")
If Left(c, 16) = "Montant du Stock" Or Left(c, 21) = "Montant Moyen
Créance" Or Left(c, 33) = "Nombre Total de dossiers en stock" Then
Range(c.Offset(0, 4), c.Offset(0, 5)).Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Else
Range(c.Offset(0, 3), c.Offset(0, 4)).Select
Selection.Interior.ColorIndex = xlNone
End If
Next c
For Each c In Range("B2:Q73")
If Left(c, 37) = "Efficacité du recouvrement (sans ACI)" Or Left(c, 13)
= "Nombre d' ACI" Or Left(c, 14) = "Montant d' ACI" Then
Range(c.Offset(0, 5)).Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Else
Range(c.Offset(0, 3), c.Offset(0, 4)).Select
Selection.Interior.ColorIndex = xlNone
End If
Next c
For Each c In Range("B2:Q73")
If Left(c, 22) = "Nombre de prestataires" Then
Range(c.Offset(0, 3), c.Offset(0, 4), c.Offset(0, 5)).Select
With Selection.Interior
.ColorIndex = 15
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Else
Range(c.Offset(0, 3), c.Offset(0, 4)).Select
Selection.Interior.ColorIndex = xlNone
End If
Next c
Next s
Range("B2").Select
Application.EnableEvents = True
FeuilleActive.Select
Application.ScreenUpdating = True
--
ALF

1 réponse

Avatar
Raymond [mvp]
Bonjour.

es-tu sûr de parler access-automatisation ou te serais-tu trompé de forum
tout simplement ? voir certainement microsoft.public.fr.excel

--
@+
Raymond Access MVP http://OfficeSystem.Access.free.fr/
Pour débuter sur le forum: http://www.mpfa.info/
Non Stop Mix '07 - Paris. La nouvelle scène web fête la créativité !
http://www.comscamp.com/Tracker/Redirect.ashx?linkid°64304e-439a-45c7-9d2f-c3326db58273


"ALF" a écrit dans le message de news:

| Bonjour,
|
| j'obtiend ce message d'erreur : erreur de compilation:
| nombre d'arguments incorrect ou affectation de propriété incorrecte
|
| et sur le code, l' erreur se positionne sur RANGE( au niveau de "Départs
| ACT" Et Apparemment,le 1er FOR EACH sur("Taux de siren") a bien passé..
|
| Par contre sur le 2eme FOR EACH sur("Départs ACT") ne passe pas et bloque
a
| ce niveau la..
|
| For Each c In Range("B2:Q73")
| If Left(c, 11) = "Départs ACT" Then
|
| l'erreur se positionne ici-------->RANGE(c.Offset(0, 1), c.Offset(0, 2),
| c.Offset(0, 4), c.Offset(0, 5)).Select
| pouvez vous resoudre ce probleme..je vous laisse ci joint le code en
question.
|
| Merci de votre soutien
|
| Dim FeuilleActive As Worksheet
| Application.ScreenUpdating = False
| Set FeuilleActive = ActiveSheet
| Dim c As Range
| For Each c In Range("B2:Q73")
| If Left(c, 13) = "Taux de siren" Then
| Range(c.Offset(0, 3), c.Offset(0, 4)).Select
| With Selection.Interior
| .ColorIndex = 15
| .Pattern = xlSolid
| .PatternColorIndex = xlAutomatic
| End With
| Else
| Range(c.Offset(0, 3), c.Offset(0, 4)).Select
| Selection.Interior.ColorIndex = xlNone
| End If
| Next c
| For Each c In Range("B2:Q73")
| If Left(c, 11) = "Départs ACT" Then
| Range(c.Offset(0, 1), c.Offset(0, 2), c.Offset(0, 4), c.Offset(0,
| 5)).Select
| With Selection.Interior
| .ColorIndex = 15
| .Pattern = xlSolid
| .PatternColorIndex = xlAutomatic
| End With
| Else
| Range(c.Offset(0, 3), c.Offset(0, 4)).Select
| Selection.Interior.ColorIndex = xlNone
| End If
| Next c
| For Each c In Range("B2:Q73")
| If Left(c, 26) = "Nombre de dossiers par ETP" Or Left(c, 24) = "Nombre
| de d'avis par ETP" Then
| Range(c.Offset(0, 1), c.Offset(0, 4), c.Offset(0, 5)).Select
| With Selection.Interior
| .ColorIndex = 15
| .Pattern = xlSolid
| .PatternColorIndex = xlAutomatic
| End With
| Else
| Range(c.Offset(0, 3), c.Offset(0, 4)).Select
| Selection.Interior.ColorIndex = xlNone
| End If
| Next c
| For Each c In Range("B2:Q73")
| If Left(c, 16) = "Montant du Stock" Or Left(c, 21) = "Montant Moyen
| Créance" Or Left(c, 33) = "Nombre Total de dossiers en stock" Then
| Range(c.Offset(0, 4), c.Offset(0, 5)).Select
| With Selection.Interior
| .ColorIndex = 15
| .Pattern = xlSolid
| .PatternColorIndex = xlAutomatic
| End With
| Else
| Range(c.Offset(0, 3), c.Offset(0, 4)).Select
| Selection.Interior.ColorIndex = xlNone
| End If
| Next c
| For Each c In Range("B2:Q73")
| If Left(c, 37) = "Efficacité du recouvrement (sans ACI)" Or Left(c, 13)
| = "Nombre d' ACI" Or Left(c, 14) = "Montant d' ACI" Then
| Range(c.Offset(0, 5)).Select
| With Selection.Interior
| .ColorIndex = 15
| .Pattern = xlSolid
| .PatternColorIndex = xlAutomatic
| End With
| Else
| Range(c.Offset(0, 3), c.Offset(0, 4)).Select
| Selection.Interior.ColorIndex = xlNone
| End If
| Next c
| For Each c In Range("B2:Q73")
| If Left(c, 22) = "Nombre de prestataires" Then
| Range(c.Offset(0, 3), c.Offset(0, 4), c.Offset(0, 5)).Select
| With Selection.Interior
| .ColorIndex = 15
| .Pattern = xlSolid
| .PatternColorIndex = xlAutomatic
| End With
| Else
| Range(c.Offset(0, 3), c.Offset(0, 4)).Select
| Selection.Interior.ColorIndex = xlNone
| End If
| Next c
| Next s
| Range("B2").Select
| Application.EnableEvents = True
| FeuilleActive.Select
| Application.ScreenUpdating = True
| --
| ALF