OVH Cloud OVH Cloud

casse tete ( pour mon niveau)

2 réponses
Avatar
Gerard
Bonjour

dans une feuille emploi du temp je selectionne dans une colonne pour coler
dans l'emploi du temps

voila ce que cela me donne sur l'evenement change

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next

If Not Intersect(Target, Range("K2:K7")) Is Nothing Then
ActiveCell.Copy
Exit Sub
End If
If Not Intersect(Target, Range("C5:H16")) Is Nothing Then
ActiveCell.PasteSpecial xlPasteAll
Application.CutCopyMode = False
End If

End Sub

jusque la cela va tres bien, ca marche impec....

maintenant je voudrais pouvoir effacer mon emploi du temps du style

Range("C5:H16").ClearContents
mais evidemment avec Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
ca met la pagaille
merci de votre aide

2 réponses

Avatar
michdenis
Bonjour Gérard,

Est-ce que cela répond à tes attentes ? J'en suis pas sûr ;-)

'------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target, Range("K2:K7")) Is Nothing Then
ActiveCell.Copy
Exit Sub
End If

If Not Intersect(Target, Range("C5:H16")) Is Nothing Then
If Application.CutCopyMode = 1 Then
Application.EnableEvents = False
ActiveCell.PasteSpecial xlPasteAll
Application.CutCopyMode = False
Application.EnableEvents = True
Else
Application.EnableEvents = False
Range("C5:H16").ClearContents
Application.EnableEvents = True
End If
End If

End Sub
'------------------------------------


Salutations!



"Gerard" a écrit dans le message de news: 4364e5c7$0$1022$
Bonjour

dans une feuille emploi du temp je selectionne dans une colonne pour coler
dans l'emploi du temps

voila ce que cela me donne sur l'evenement change

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next

If Not Intersect(Target, Range("K2:K7")) Is Nothing Then
ActiveCell.Copy
Exit Sub
End If
If Not Intersect(Target, Range("C5:H16")) Is Nothing Then
ActiveCell.PasteSpecial xlPasteAll
Application.CutCopyMode = False
End If

End Sub

jusque la cela va tres bien, ca marche impec....

maintenant je voudrais pouvoir effacer mon emploi du temps du style

Range("C5:H16").ClearContents
mais evidemment avec Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
ca met la pagaille
merci de votre aide
Avatar
Gerard
Bonjour et merci
ca va
Application.CutCopyMode = 1
il suffisait tout simplement de faire une condition si le presspapier
contenanait quelque chose
n'es ce pas
je n'y avait pas pensé
merci encore

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

Bonjour Gérard,

Est-ce que cela répond à tes attentes ? J'en suis pas sûr ;-)

'------------------------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target, Range("K2:K7")) Is Nothing Then
ActiveCell.Copy
Exit Sub
End If

If Not Intersect(Target, Range("C5:H16")) Is Nothing Then
If Application.CutCopyMode = 1 Then
Application.EnableEvents = False
ActiveCell.PasteSpecial xlPasteAll
Application.CutCopyMode = False
Application.EnableEvents = True
Else
Application.EnableEvents = False
Range("C5:H16").ClearContents
Application.EnableEvents = True
End If
End If

End Sub
'------------------------------------


Salutations!



"Gerard" a écrit dans le message de news:
4364e5c7$0$1022$
Bonjour

dans une feuille emploi du temp je selectionne dans une colonne pour coler
dans l'emploi du temps

voila ce que cela me donne sur l'evenement change

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next

If Not Intersect(Target, Range("K2:K7")) Is Nothing Then
ActiveCell.Copy
Exit Sub
End If
If Not Intersect(Target, Range("C5:H16")) Is Nothing Then
ActiveCell.PasteSpecial xlPasteAll
Application.CutCopyMode = False
End If

End Sub

jusque la cela va tres bien, ca marche impec....

maintenant je voudrais pouvoir effacer mon emploi du temps du style

Range("C5:H16").ClearContents
mais evidemment avec Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
ca met la pagaille
merci de votre aide