Bonsoir
J'essaie de créer une proc qui selectionne une feuille différente chaque
saison, elle plante sauf en hiver
Pourriez-vous me proposer une syntaxe plus évidente ;-)
Merci beaucoup
Michel
'test sur les saisons
'Hiver 21/12
If Month(Date) >= 1 And Day(Date) >= 1 And _
Month(Date) < 4 And Day(Date) < 20 Then
Application.ScreenUpdating = False
Sheets("Hiver").Select
End If
'Printemps 20/03
If Month(Date) > 2 And Day(Date) > 19 And _
Month(Date) < 7 And Day(Date) < 21 Then
'Application.ScreenUpdating = False
Sheets("Printemps").Select
End If
'Eté 21/06
If Month(Date) >= 6 And Day(Date) >= 21 And _
Month(Date) < 10 And Day(Date) < 23 Then
Application.ScreenUpdating = False
Sheets("Ete").Select
End If
'Automne 22/09
If Month(Date) >= 9 And Day(Date) >= 22 And _
Month(Date) <= 12 And Day(Date) < 22 Then
Application.ScreenUpdating = False
Sheets("Automne").Select
End If
'Hiver 21/12
If Month(Date) >= 12 And Day(Date) >= 21 And _
Month(Date) <= 12 And Day(Date) <= 31 Then
Application.ScreenUpdating = False
Sheets("Hiver").Select
End If
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
FxM
Bonsoir,
Limites sont à vérifier (< ou <=)
Public Function test(dat) Select Case dat Case Is < DateSerial(Year(dat), 3, 20) test = "hiver" Case Is < DateSerial(Year(dat), 6, 21) test = "Printemps" Case Is < DateSerial(Year(dat), 9, 22) test = "Ete" Case Is < DateSerial(Year(dat), 12, 21) test = "Automne" Case Else test = "Hiver2" End Select End Function
For Each vale In arr lig = Range("A65536").End(xlUp).Row + 1 Range("A" & lig) = vale Range("B" & lig) = test(vale) Next vale End Sub
@+ FxM
Bonsoir J'essaie de créer une proc qui selectionne une feuille différente chaque saison, elle plante sauf en hiver Pourriez-vous me proposer une syntaxe plus évidente ;-) Merci beaucoup Michel
'test sur les saisons 'Hiver 21/12 If Month(Date) >= 1 And Day(Date) >= 1 And _ Month(Date) < 4 And Day(Date) < 20 Then Application.ScreenUpdating = False Sheets("Hiver").Select End If 'Printemps 20/03 If Month(Date) > 2 And Day(Date) > 19 And _ Month(Date) < 7 And Day(Date) < 21 Then 'Application.ScreenUpdating = False Sheets("Printemps").Select End If 'Eté 21/06 If Month(Date) >= 6 And Day(Date) >= 21 And _ Month(Date) < 10 And Day(Date) < 23 Then Application.ScreenUpdating = False Sheets("Ete").Select End If 'Automne 22/09 If Month(Date) >= 9 And Day(Date) >= 22 And _ Month(Date) <= 12 And Day(Date) < 22 Then Application.ScreenUpdating = False Sheets("Automne").Select End If 'Hiver 21/12 If Month(Date) >= 12 And Day(Date) >= 21 And _ Month(Date) <= 12 And Day(Date) <= 31 Then Application.ScreenUpdating = False Sheets("Hiver").Select End If
Bonsoir,
Limites sont à vérifier (< ou <=)
Public Function test(dat)
Select Case dat
Case Is < DateSerial(Year(dat), 3, 20)
test = "hiver"
Case Is < DateSerial(Year(dat), 6, 21)
test = "Printemps"
Case Is < DateSerial(Year(dat), 9, 22)
test = "Ete"
Case Is < DateSerial(Year(dat), 12, 21)
test = "Automne"
Case Else
test = "Hiver2"
End Select
End Function
For Each vale In arr
lig = Range("A65536").End(xlUp).Row + 1
Range("A" & lig) = vale
Range("B" & lig) = test(vale)
Next vale
End Sub
@+
FxM
Bonsoir
J'essaie de créer une proc qui selectionne une feuille différente chaque
saison, elle plante sauf en hiver
Pourriez-vous me proposer une syntaxe plus évidente ;-)
Merci beaucoup
Michel
'test sur les saisons
'Hiver 21/12
If Month(Date) >= 1 And Day(Date) >= 1 And _
Month(Date) < 4 And Day(Date) < 20 Then
Application.ScreenUpdating = False
Sheets("Hiver").Select
End If
'Printemps 20/03
If Month(Date) > 2 And Day(Date) > 19 And _
Month(Date) < 7 And Day(Date) < 21 Then
'Application.ScreenUpdating = False
Sheets("Printemps").Select
End If
'Eté 21/06
If Month(Date) >= 6 And Day(Date) >= 21 And _
Month(Date) < 10 And Day(Date) < 23 Then
Application.ScreenUpdating = False
Sheets("Ete").Select
End If
'Automne 22/09
If Month(Date) >= 9 And Day(Date) >= 22 And _
Month(Date) <= 12 And Day(Date) < 22 Then
Application.ScreenUpdating = False
Sheets("Automne").Select
End If
'Hiver 21/12
If Month(Date) >= 12 And Day(Date) >= 21 And _
Month(Date) <= 12 And Day(Date) <= 31 Then
Application.ScreenUpdating = False
Sheets("Hiver").Select
End If
Public Function test(dat) Select Case dat Case Is < DateSerial(Year(dat), 3, 20) test = "hiver" Case Is < DateSerial(Year(dat), 6, 21) test = "Printemps" Case Is < DateSerial(Year(dat), 9, 22) test = "Ete" Case Is < DateSerial(Year(dat), 12, 21) test = "Automne" Case Else test = "Hiver2" End Select End Function
For Each vale In arr lig = Range("A65536").End(xlUp).Row + 1 Range("A" & lig) = vale Range("B" & lig) = test(vale) Next vale End Sub
@+ FxM
Bonsoir J'essaie de créer une proc qui selectionne une feuille différente chaque saison, elle plante sauf en hiver Pourriez-vous me proposer une syntaxe plus évidente ;-) Merci beaucoup Michel
'test sur les saisons 'Hiver 21/12 If Month(Date) >= 1 And Day(Date) >= 1 And _ Month(Date) < 4 And Day(Date) < 20 Then Application.ScreenUpdating = False Sheets("Hiver").Select End If 'Printemps 20/03 If Month(Date) > 2 And Day(Date) > 19 And _ Month(Date) < 7 And Day(Date) < 21 Then 'Application.ScreenUpdating = False Sheets("Printemps").Select End If 'Eté 21/06 If Month(Date) >= 6 And Day(Date) >= 21 And _ Month(Date) < 10 And Day(Date) < 23 Then Application.ScreenUpdating = False Sheets("Ete").Select End If 'Automne 22/09 If Month(Date) >= 9 And Day(Date) >= 22 And _ Month(Date) <= 12 And Day(Date) < 22 Then Application.ScreenUpdating = False Sheets("Automne").Select End If 'Hiver 21/12 If Month(Date) >= 12 And Day(Date) >= 21 And _ Month(Date) <= 12 And Day(Date) <= 31 Then Application.ScreenUpdating = False Sheets("Hiver").Select End If
Michel.Girard
Merci beaucoup François Michel
"FxM" a écrit dans le message de news: %23%
Bonsoir,
Limites sont à vérifier (< ou <=)
Public Function test(dat) Select Case dat Case Is < DateSerial(Year(dat), 3, 20) test = "hiver" Case Is < DateSerial(Year(dat), 6, 21) test = "Printemps" Case Is < DateSerial(Year(dat), 9, 22) test = "Ete" Case Is < DateSerial(Year(dat), 12, 21) test = "Automne" Case Else test = "Hiver2" End Select End Function
For Each vale In arr lig = Range("A65536").End(xlUp).Row + 1 Range("A" & lig) = vale Range("B" & lig) = test(vale) Next vale End Sub
@+ FxM
Bonsoir J'essaie de créer une proc qui selectionne une feuille différente chaque saison, elle plante sauf en hiver Pourriez-vous me proposer une syntaxe plus évidente ;-) Merci beaucoup Michel
'test sur les saisons 'Hiver 21/12 If Month(Date) >= 1 And Day(Date) >= 1 And _ Month(Date) < 4 And Day(Date) < 20 Then Application.ScreenUpdating = False Sheets("Hiver").Select End If 'Printemps 20/03 If Month(Date) > 2 And Day(Date) > 19 And _ Month(Date) < 7 And Day(Date) < 21 Then 'Application.ScreenUpdating = False Sheets("Printemps").Select End If 'Eté 21/06 If Month(Date) >= 6 And Day(Date) >= 21 And _ Month(Date) < 10 And Day(Date) < 23 Then Application.ScreenUpdating = False Sheets("Ete").Select End If 'Automne 22/09 If Month(Date) >= 9 And Day(Date) >= 22 And _ Month(Date) <= 12 And Day(Date) < 22 Then Application.ScreenUpdating = False Sheets("Automne").Select End If 'Hiver 21/12 If Month(Date) >= 12 And Day(Date) >= 21 And _ Month(Date) <= 12 And Day(Date) <= 31 Then Application.ScreenUpdating = False Sheets("Hiver").Select End If
Merci beaucoup François
Michel
"FxM" <nullos@greuchmeu.ici> a écrit dans le message de news:
%23%23coJFWDFHA.1264@TK2MSFTNGP12.phx.gbl...
Bonsoir,
Limites sont à vérifier (< ou <=)
Public Function test(dat)
Select Case dat
Case Is < DateSerial(Year(dat), 3, 20)
test = "hiver"
Case Is < DateSerial(Year(dat), 6, 21)
test = "Printemps"
Case Is < DateSerial(Year(dat), 9, 22)
test = "Ete"
Case Is < DateSerial(Year(dat), 12, 21)
test = "Automne"
Case Else
test = "Hiver2"
End Select
End Function
For Each vale In arr
lig = Range("A65536").End(xlUp).Row + 1
Range("A" & lig) = vale
Range("B" & lig) = test(vale)
Next vale
End Sub
@+
FxM
Bonsoir
J'essaie de créer une proc qui selectionne une feuille différente chaque
saison, elle plante sauf en hiver
Pourriez-vous me proposer une syntaxe plus évidente ;-)
Merci beaucoup
Michel
'test sur les saisons
'Hiver 21/12
If Month(Date) >= 1 And Day(Date) >= 1 And _
Month(Date) < 4 And Day(Date) < 20 Then
Application.ScreenUpdating = False
Sheets("Hiver").Select
End If
'Printemps 20/03
If Month(Date) > 2 And Day(Date) > 19 And _
Month(Date) < 7 And Day(Date) < 21 Then
'Application.ScreenUpdating = False
Sheets("Printemps").Select
End If
'Eté 21/06
If Month(Date) >= 6 And Day(Date) >= 21 And _
Month(Date) < 10 And Day(Date) < 23 Then
Application.ScreenUpdating = False
Sheets("Ete").Select
End If
'Automne 22/09
If Month(Date) >= 9 And Day(Date) >= 22 And _
Month(Date) <= 12 And Day(Date) < 22 Then
Application.ScreenUpdating = False
Sheets("Automne").Select
End If
'Hiver 21/12
If Month(Date) >= 12 And Day(Date) >= 21 And _
Month(Date) <= 12 And Day(Date) <= 31 Then
Application.ScreenUpdating = False
Sheets("Hiver").Select
End If
Public Function test(dat) Select Case dat Case Is < DateSerial(Year(dat), 3, 20) test = "hiver" Case Is < DateSerial(Year(dat), 6, 21) test = "Printemps" Case Is < DateSerial(Year(dat), 9, 22) test = "Ete" Case Is < DateSerial(Year(dat), 12, 21) test = "Automne" Case Else test = "Hiver2" End Select End Function
For Each vale In arr lig = Range("A65536").End(xlUp).Row + 1 Range("A" & lig) = vale Range("B" & lig) = test(vale) Next vale End Sub
@+ FxM
Bonsoir J'essaie de créer une proc qui selectionne une feuille différente chaque saison, elle plante sauf en hiver Pourriez-vous me proposer une syntaxe plus évidente ;-) Merci beaucoup Michel
'test sur les saisons 'Hiver 21/12 If Month(Date) >= 1 And Day(Date) >= 1 And _ Month(Date) < 4 And Day(Date) < 20 Then Application.ScreenUpdating = False Sheets("Hiver").Select End If 'Printemps 20/03 If Month(Date) > 2 And Day(Date) > 19 And _ Month(Date) < 7 And Day(Date) < 21 Then 'Application.ScreenUpdating = False Sheets("Printemps").Select End If 'Eté 21/06 If Month(Date) >= 6 And Day(Date) >= 21 And _ Month(Date) < 10 And Day(Date) < 23 Then Application.ScreenUpdating = False Sheets("Ete").Select End If 'Automne 22/09 If Month(Date) >= 9 And Day(Date) >= 22 And _ Month(Date) <= 12 And Day(Date) < 22 Then Application.ScreenUpdating = False Sheets("Automne").Select End If 'Hiver 21/12 If Month(Date) >= 12 And Day(Date) >= 21 And _ Month(Date) <= 12 And Day(Date) <= 31 Then Application.ScreenUpdating = False Sheets("Hiver").Select End If