Bonjour
apres avoir essayé quelques manipulations pour joindre deux code ,(avoir un deux code en un ) je n'aboutis pas
voici le premier :
Option Explicit
Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Integer
Dim xcell As Range
If Not Intersect(Range("A2:A500"), Target) Is Nothing And Target.Count = 1 Then
'j'ajoute ca :
For Each xcell In Intersect(Range("A2:A500"), Target)
Sheets("Feuil2").Range("K2") = xcell
Next xcell
For i = 21 To 100 'B1 à B21 remplies
If Sheets("Feuil1").Cells(i, 2) = "" Then
Sheets("Feuil1").Cells(i, 2) = Target.Value
Sheets("Feuil1").Select
Exit Sub
End If
Next
MsgBox ("Aucune cellule libre, sur la feuille 1, de la cellule B1 à la cellule B21")
End If
End Sub
et
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("B21:B100" & Range("A65536").End(xlUp).Row)) Is Nothing And Target.Count = 1 Then
If Target = "" Then
Exit Sub
Else
If Cells(Target.Row, Target.Column + 1) = "" Then
If WorksheetFunction.Max(Range("C21:C100" & Range("A65536").End(xlUp).Row)) = 0 Then
Cells(Target.Row, Target.Column + 1) = 111000
Else
Cells(Target.Row, Target.Column + 1) = WorksheetFunction.Max(Range("C21:C100" & Range("A65536").End(xlUp).Row)) + 1
End If
End If
End If
End If
Vous remerciant pour vos lumières