Problème Macro

Bonjour à tous

Ma macro fonctionne mais elle protège systématiquement la feuille... et dois systématiquement ôter la protection.

Un peu... nul en VBA, quelqu'un peut retirer le Password sans que cela bug.

Par avance merci

Lego

Macro (changement couleur cellule active) ci-dessous:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Set champ = Range("A1:FK550")

If Not Intersect(champ, Target) Is Nothing Then

ActiveSheet.Unprotect Password:=""

champ.FormatConditions.Delete

If Target.Count = 1 Then

Intersect(Target, champ).FormatConditions.Add Type:=xlExpression, Formula1:="VRAI"

Intersect(Target, champ).FormatConditions(1).Interior.ColorIndex = 8

Target.FormatConditions(1).Font.Bold = True

End If

ActiveSheet.Protect Password:=""

End If

End Sub

Bonjour

Essaie ça :

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
 Set champ = Range("A1:FK550")
    If Not Intersect(champ, Target) Is Nothing Then

        champ.FormatConditions.Delete
        If Target.Count = 1 Then
            Intersect(Target, champ).FormatConditions.Add Type:=xlExpression, Formula1:="VRAI"
            Intersect(Target, champ).FormatConditions(1).Interior.ColorIndex = 8
            Target.FormatConditions(1).Font.Bold = True
        End If

    End If
 End Sub

@gmb : bonjour...

Bonjour.

Ben non désolé ça bug.

A suivre...

Merci de votre aide

Lego

Alors, joins ton fichier !

Bye !

voici un fichier.

a+

Lego

En retour :

Génial

merci beaucoup.

Lego

Jean-Eric a écrit :

@gmb : bonjour...

Hello,

Sorry that my message is a little bit out of topic, but I also have a big problem with macro. It is like 5 days that I am struggling with it, and can not fix

I have to record making pivot and then print it, but the problem that when I am running my macro, in pivot it is only coming total number (without lignes and values). It is like not recording this step. If you have any ideas, could you please help? I am really out of power already.

Rechercher des sujets similaires à "probleme macro"