Bonsoir
J'ai un code VBA ( voir ci dessous) qui fonctionne, un deuxième qui seul fonctionne aussi.....a présent j'aimerais les relier pour qu'ils fonctionnent les deux car uniquement le premier fonctionne actuellement
Merci pour l'aide
Berno
Option Explicit
Sub Macro5()
Dim ville$, lig&, col%, ltr$
With ActiveCell
ville = .Value: If ville = "" Then Exit Sub
lig = .Row: If lig < 3 Or lig > 1481 Then Exit Sub
col = .Column: If col <> 5 And col <> 7 And col <> 9 And col <> 11 Then Exit Sub
ltr = Cells(lig, 3): If ltr <> "NUIT" Then Exit Sub
.Offset(4) = ville: If lig <= 1481 Then .Offset(9) = ville
If lig <= 1481 Then .Offset(13) = ville
If lig <= 1481 Then .Offset(18) = ville
If lig <= 1481 Then .Offset(22) = ville
' Deuxième code
ltr = Cells(lig, 3): If ltr <> "MATIN" Then Exit Sub
.Offset(4) = ville: If lig <= 1481 Then .Offset(9) = ville
If lig <= 1481 Then .Offset(13) = ville
End With
End Sub
••••ˇˇˇˇ
J'ai un code VBA ( voir ci dessous) qui fonctionne, un deuxième qui seul fonctionne aussi.....a présent j'aimerais les relier pour qu'ils fonctionnent les deux car uniquement le premier fonctionne actuellement
Merci pour l'aide
Berno
Option Explicit
Sub Macro5()
Dim ville$, lig&, col%, ltr$
With ActiveCell
ville = .Value: If ville = "" Then Exit Sub
lig = .Row: If lig < 3 Or lig > 1481 Then Exit Sub
col = .Column: If col <> 5 And col <> 7 And col <> 9 And col <> 11 Then Exit Sub
ltr = Cells(lig, 3): If ltr <> "NUIT" Then Exit Sub
.Offset(4) = ville: If lig <= 1481 Then .Offset(9) = ville
If lig <= 1481 Then .Offset(13) = ville
If lig <= 1481 Then .Offset(18) = ville
If lig <= 1481 Then .Offset(22) = ville
' Deuxième code
ltr = Cells(lig, 3): If ltr <> "MATIN" Then Exit Sub
.Offset(4) = ville: If lig <= 1481 Then .Offset(9) = ville
If lig <= 1481 Then .Offset(13) = ville
End With
End Sub
••••ˇˇˇˇ