Aide sur une macro

Mister Binaire

XLDnaute Occasionnel
Bonsoir le Forum,

Je voudrais que les datas soient envoyés uniquement sur la feuille "Formulaire Process" et supprimer ainsi le Select Case cells (I,3) .

Qui peut me modifier la macro pour que cela marche !!

Merci d'avance
MB

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Dim i As Integer
Dim Feuille As String
Dim PL As Range

If Target.Value <> "" Then Cancel = True: Exit Sub
If Target.Column = 4 And Target.Row > 11 And Cells(Target.Row, 1) <> "" Then
Cancel = True
i = Target.Row
Select Case Cells(i, 3)
Case "Process": Feuille = "Formulaire Process"
Case "Demande de Travaux": Feuille = "Formulaire DT"
End Select
With Sheets(Feuille)
.[W1] = .[W1] + 1
Set PL = .Range("A6:A43")
PL(.[W1]) = Cells(i, 1)
PL(.[W1]).Offset(, 1) = Cells(i, 2)
End With
Cells(i, 4) = "ü"
End If
End Sub
 

Papou-net

XLDnaute Barbatruc
Re : Aide sur une macro

Bonsoir MB,

Peut-être comme ceci tout simplement:

Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Dim i As Integer
Dim PL As Range

If Target.Value <> "" Then Cancel = True: Exit Sub
If Target.Column = 4 And Target.Row > 11 And Cells(Target.Row, 1) <> "" Then
    Cancel = True
    i = Target.Row
    With Sheets("Formulaire Process")
        .[W1] = .[W1] + 1
        Set PL = .Range("A6:A43")
        PL(.[W1]) = Cells(i, 1)
        PL(.[W1]).Offset(, 1) = Cells(i, 2)
    End With
    Cells(i, 4) = "ü"
End If
End Sub

NB: pas testé puisque pas de fichier.

Cordialement.
 

Discussions similaires

Statistiques des forums

Discussions
312 492
Messages
2 088 893
Membres
103 982
dernier inscrit
krakencolas